Hi, I am new to the forums(and to Pic's) and have been trying to learn about serial communications between different chips. I have a PIC16f688 and am trying to communicate with a 3.3V device and a Hyperterminal over RS232. I have been successful communicating with the Hyperterminal so far, but receiving communications form the 3.3V chip to the PIC have not been so successful. I have used an inverter chip to adjust voltage levels coming from the 3.3V chip to the PIC to 0-5V logic. I also have a monitor that came with the 3.3V device that allows me to see what the chip is responding in HEX format. I have even used a scope to see the waveforms being output from the 3.3V device. I am stumped as I see the reply from the 3.3V chip in the provided monitor and on my scope, but the PIC is hanging on the Serin call. Here is the code that I am using:
Include "modedefs.bas" 'includes Serial functionality
Define OSC 4 'use the 4 MHz internal oscilitor
HTO var PORTC.4 'make RC4 output hyperterm
HTI var PORTC.5 'make RC5 input hyperterm
XBI var PORTC.1 'make RC1 input XBEE
XBO var PORTC.2 'Make RC2 output XBEE
TRISC = %101010 'Sets the directions of the bits on portc
ANSEL = $11 'port c digital io
b0 var byte 'the variable to store the input into
b1 var byte
b2 var byte
b3 var byte
b4 var byte
b5 var byte
b6 var byte
b7 var byte
'byteArr var BYTE[8]
i var byte
start:
'using inverted baudrate to communicate with the
'HT through a 440 ohm on the TX and a
'22K ohm on the RX Pins
'let it warm up .1sec
Pause 100
Serout XBO,N9600,["Starting UART.....",10,13]
loop:
Serout XBO,N9600,["Query the xbee module....",10,13]
Serout HTO,T2400,[$05,$01,$05,$02,$08,$04 ]
Serin HTI,T2400,[b0,b1,b2,b3,b4,b5,b6,b7]
'Hangs here........
Serout XBO,N9600,["Retry"]
Serout XBO,N9600,["Reply from XBEE...",10,13]
Serout XBO,N9600,[#b0,#b1,#b2,#b3,#b4,#b5,#b6,#b7]
Serout XBO,N9600,[10,13]
Serout XBO,N9600,["That is all folks",10,13]
Pause 1000 'pause 1 sec
Goto loop ''endless loop
End
I am stumped.... any help would be greatly appreciated.
Thank you,
oni
Bookmarks