SCREENSHOT 4. Everything works as designed. While
we had the Atlanta H-bridge node's attention, I thought
it would be nice to get the local temperature.
The Atlanta node receiver modules respond to an
interrupt that is triggered by an incoming character. The
incoming data is retrieved from the PIC18F46J13’s UART
and placed in the receive buffer. The presence of any data
in the buffer is detected by the main program by calling the
CharInQueue function. If the receive buffer contains a
character, the recvchar function is called to remove the
character from the buffer. The retrieved character is then
processed by the main program. In the case of this test,
the incoming character will be an H-bridge command.
The main test routine code looks like this:
if(CharInQueue())
{
bitein = recvchar();
switch(bitein)
{
case ‘1’:
hb1outa;
fprintf(atlanta,”CMD 1 RECEIVED - A is
ON\r\n”);
break;
case ‘2’:
hb1outb;
fprintf(atlanta,”CMD 2 RECEIVED -
B is ON\r\n”);
break;
case ‘3’:
hb1brake;
fprintf(atlanta,”CMD 3 RECEIVED -
H-Bridge is OFF\r\n”);
break;
}
PHOTO 5. You too
can accurately obtain
temperature readings
with this puppy. All
you have to do is
power it with 3. 3
VDC, read it with your
microcontroller's
analog-to-digital
converter, and use
the firmware I've
provided to
extrapolate the
actual temperature.
}
Everything is now in place to test the Atlanta node. We
will use Tera Term to contact the H-bridge controller and
exercise H-bridge 1. We are sitting on the launch pad in
Screenshot 3.
Houston, This is Cape
We have cleared the tower. As you can see in
Screenshot 4, all three commands that were issued from
the Tera Term Telnet session were acknowledged by the
Atlanta H-bridge Internet appliance. What’s up with that
temperature report?
Since we were in contact with the Atlanta H-bridge
node, it would only take a small bit of additional code to
collect the local temperature:
void getTemp(void)
{
int1 done;
set_adc_channel(6);
delay_ms(10);
read_adc(ADC_START_ONLY);
done = adc_done();
while(!done)
{
done = adc_done();
}
tempmv = read_adc();
tempmv *= 0.805664;
tempC = 0.0512 tempmv
- 20.5128;
SCREENSHOT 5. This is an Android
view of the Atlanta H-bridge Telnet
session. This screenshot is presented
to you courtesy of my Samsung
Galaxy Tab.
56 SERVO 06.2013