Re: Serin -> Hserout -> Hserin -> LCDOUT
The hardware serial port will only deal with individual bytes. Whatever else is or is not going on, you cannot read directly into a word variable in that manner. You could use
Code:
Hserin [char.byte0]
. I rarely use LCDs so I have no idea what the implications of using a word in writing to one.
You are correct in that the hardware serial port sounds right for your application. You have a two-byte buffer that will happily receive data in the background while the PIC is busy doing other stuff. At your leisure you can test the flag for when the buffer has data in it ("If PIR1.5 = 1 then...") and grab it when you can.
but I cannot get hserin to respond, except from another pic
Ahh. Are you using a MAX232 type of level shifter, or have otherwise taken into account the the hardware port cannot invert the data like serin can?
For a test, I'd try writing "DEC char" to your LCD. See if maybe you are getting the reversed bits, although I'm not sure what effect this would have on the start/stop bits. Nothing good I'm sure! Neglecting that, "k" would show up as 107 but if it were inverted it would be 148 instead.
Just to make sure, you've confirmed that data is actually getting received by the port, it just appears garbled, right?
Although I've never used the PIC16f1829 specifically, I use the hardware port a *lot*. There is no reason it shouldn't work. A 50Hz signal will only interrupt about every 20 msec, an eternity in electronics terms. Handling a single byte shouldn't necessitate an additional PIC.
I understand your frustration, and apologize if I've mentioned items that have already been covered. However, I keep having to learn over and over again to (1) check *everything* and (2) make no assumptions.
Best Regards,
Paul
The way to avoid mistakes is to gain experience. The way to gain experience is to make mistakes.
Bookmarks