When passing values through Serout and Serin, is it best to define say Temp VAR
BYTE or Temp VAR WORD.
And after Serin, should I save the received data to a different location or can
I just use it directly?
For example
loop:
Serin2 PORTC.7,16780,[wait("ABC"),temp,temp1]
Lcdout $fe,1
Lcdout DEC temp,DEC2 temp1
pause 200
goto loop
or
should I save temp into a different place then LCDout?
Reply by randy ram●March 11, 20042004-03-11
Did I mention that this data was going to be displayed on to a LCD.
Reply by ●March 8, 20042004-03-08
> I get an error saying Bad expression. If I remove
it, there is no error. But I rather use the wait. Is there anything I have to
declare or define something at the top of the program?
That is a perfectly good command, Randy. There are several things that could
give you a "bad expression" when compiling:
si not declared
N9600 not declared
make sure your xmission is enclosed in " [ ] ", not " { }
".
Don't know what PIC you are using - maybe it uses serin, not serin2.
Anyway,
stay with it - it is a good command.
Sid
Reply by randy ram●March 7, 20042004-03-07
Why is that everytime I use the 'wait' in say,
serin2 si, N9600, [wait("ABC"), com]
I get an error saying Bad expression. If I remove it, there is no error. But I
rather use the wait. Is there anything I have to declare or define something at
the top of the program?
Randy
Reply by ●March 7, 20042004-03-07
Here is a way to establish communication between two PICs:
Master
Slave:
If you are in a noisy environment, you might want to write for the master:
serout2 so, baud, ["ABC", "X"]
and for the slave:
serin2 si, baud, [wait("ABC"), com]
The ABC on serin ensures that the slave will wait for a transmission beginning
with "ABC" and will ignore all other signals.
Once you have established communication, you can send the slave other commands
to have it perform a task. Remember that the PIC has no buffer, so when you
send a command from the master to the slave, the slave must be sitting there
waiting for it, not off doing something else.
The connections between the PIC serin and serout lines should be via a 270 ohm
resistor to protect the I/O ports.
Sid
Reply by randy ram●March 6, 20042004-03-06
I am using a 877A. Can I then transmit from it and receive on another PIC such
as the 628? I guess that can be done. I guess I will have to turn the 628 (rx)
first before the 877A(tx). Next question will be how will I set us the the
receiving PIC? Will the same code that I post on this topic work?
Thanks
Randy
Reply by ●March 6, 20042004-03-06
> Has anyone tried sending and receiving on the same
pic using Serin/Serin2 and Serout/Serout2?
You can't do that because when the PIC gets to serin the message has
already been sent and there is nothing there to receive.
Sid
Reply by ramtec73●March 6, 20042004-03-06
Has anyone tried sending and receiving on the same pic using
Serin/Serin2 and Serout/Serout2?
Reply by Charles Linquist●March 6, 20042004-03-06
You need a comma, not a period between $FE and $C0
Charles Linquist
Reply by ramtec73●March 6, 20042004-03-06
Here is what I have. I am using a PIC16F877A and PICBasic Pro
So far all I see on the LCD is just 'test serout' on the first
line.
I thought this line of codes will print 'test serout' on the first
line and '5' on the second line.