PDA

View Full Version : serin



buggs
- 9th July 2008, 20:53
Hi Guys,
You would think this would be easy. So here goes
First, i am always going to be new to this stuff
Rules:
This is TTL-level
PIC16f87
RV1 var word ' hopefully receive return value
RV1 = 0
baud 9600;parity,none;databit,8;stopbit,none;flowcontro l:none.

We are sending serial commands [SEROUT] to a processor that work well, we get a sound response.
I am supposed to receive these "return values" of 0x01, or 0x02 from this serial connection

So,I wrote:

SERIN PORTA.2,T9600,RV1

What should i be receiving on RV1 with those "return values"?

decimal, ascii, hex, nothing ????

Thanks

skimask
- 9th July 2008, 21:29
So,I wrote:
SERIN PORTA.2,T9600,RV1
What should i be receiving on RV1 with those "return values"?
decimal, ascii, hex, nothing ????
Thanks
Assuming you receive valid serial data, RV1 will contain the raw value received, not the decimal equivalent, not the hex equivalent, just the straight binary equivalent of whatever was received by the SERIN statement. If you were using a hardware serial port, RV1 would contain whatever was in the RXREG.
In your case, I would guess that RV1 should contain just what you said, 0x01 (binary 00000001) and so on...
You can use the modifiers listed in the PBP manual to get them differently if need be...

Also, see post #16 here...
http://www.picbasic.co.uk/forum/showthread.php?t=9137

amgen
- 9th July 2008, 21:50
don't you have to direct to....

SERIN PORTA.2,T9600,RV1.byte0

SERIN PORTA.2,T9600,RV1.byte1

?