Re: HSEROUT question
It sounds like I have a setting issue, but also is my code correct?
Yes your code will output @ 2400 bauds the string equivalent of [Cntrl-A "p" "+" "01" Cntrl-C], but you should tell the frequency of your clock to check it completely.
Assuming your clock to be 4 MHz then the setting should be:
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER_SPBRG 25 ' 2400 Baud @ 4MHz, 0,17%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
Now if your board Tx & Rx fine with your PC and your device as well then you will need a crossed cable to communicate from board to device. Check the RS232 cable you are using to communicate from your PC to the Device and see if pin 2 (DB9) correspond to pin 2 on the other side and if pin 3 correspond to pin 3. In this case your device is wired as a DCE and you are using correctly a straight cable since your PC is a DTE. In this case also your bord is a DCE so to communicate between two DCEs you will need to cross the Pin2 with Pin 3 (DB9) on one side, so that Rx ----> Tx & Tx ----> Rx Ground -----> Ground.
You should then have the serial communication you desire.
Cheers
Al.
Last edited by aratti; - 22nd February 2011 at 17:03.
All progress began with an idea
Bookmarks