|
|
View previous topic :: View next topic |
Author |
Message |
fredp
Joined: 09 Nov 2005 Posts: 2
|
A simple (hopefully) RS232 setup question |
Posted: Wed Nov 09, 2005 12:45 pm |
|
|
Hi All,
My first post so be kind ;-)
I'm currently implementing a graphical touch-screen product using
Main MCU: PIC18F4680, external oscillator @ 40MHz
LCD Ctrl: SED1335
Touch Screen Controller Mod: Fujitsu N16B-0558-B230 (serial)
My question relates to communicating with the N16B-0558-B230. This is a pretty simple device but I'm having some difficulty configuring the RS232 for coherent communications.
Ok, I have a PC running HyperTerm connected to P6 and P7 (Uart) for bebugging. This is and has been working fine. For that I'm using:
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, BITS=1, PARITY=N)
I have the N16B-0558-B230 connected to D2 and D3
The PIC18F4680 manual (written bilingually in Japanese and English, yikes!) says this about the RS232 setup:
"Bit format: 1 start bit + 8 data bits + 1 stop bit Total 10 bits No parity"bits. They also list the speed as 9600 bps.
I've set up the rs232 thusly for the N16B-0558-B230:
#use rs232(baud=9600, xmit=TS_RX, rcv=TS_TX, BITS=9, FORCE_SW, PARITY=N, DISABLE_INTS, LONG_DATA)
Data comes over at the proper times... but I'm having some difficulty getting it to make sense.
Am I a bit short? (no pun intended). Any suggestions/comments?
Thanks in advance for your help
** Fred ** |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Nov 09, 2005 12:51 pm |
|
|
Why are you telling the PIC to use 9 bits when the display uses 8 bits?
Drop the bits=9 and see how that works. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Nov 09, 2005 12:57 pm |
|
|
Quote: |
Ok, I have a PC running HyperTerm connected to P6 and P7 (Uart) for debugging. This is and has been working fine. For that I'm using:
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, BITS=1, PARITY=N) |
In the statement above, BITS=1 is wrong. The compiler is simply
ignoring it. Also, what are "P6" and "P7" ? Do you mean C6 and C7 ?
If so, you should state such.
Quote: | #use rs232(baud=9600, xmit=TS_RX, rcv=TS_TX, BITS=9, FORCE_SW, PARITY=N, DISABLE_INTS, LONG_DATA) |
The start and stop bits are implicit. The "BITS" parameter refers
to data bits. It defaults to 8. You don't even need it. It also
defaults to no parity. Just keep everything simple. Use this:
Code: | #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS) |
|
|
|
Guest
|
|
Posted: Wed Nov 09, 2005 1:10 pm |
|
|
Yes, C6 and C7, sorry. You're right, I don't know when I hosed the BITS parameter (BITS=1) but it sure is wrong... if it hadn't ignored it I would have had to fix it huh?
So the start-bit is implicit... good! It's usually not even brought up... which is what threw me.
Thanks bunches. I'm sure it'll be coherent now... specially since I just noticed I have to flip the bit-order (duh!)
Thanks again
Fred |
|
|
Guest
|
|
Posted: Wed Nov 09, 2005 1:12 pm |
|
|
SherpaDoug wrote: | Why are you telling the PIC to use 9 bits when the display uses 8 bits?
Drop the bits=9 and see how that works. |
The "display" isn't what I'm having trouble with... the display is working fine. The SED1335 is not a serial device anyway.
However, as it turns out, dropping the bits=9 is indeed part of the solution.
Thanks for your response.
Fred |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|