Sonsivri

Electronics => Pic Basic Languages => Topic started by: Pikoko on May 06, 2009, 09:39:15 21:39



Title: pisbasic serial help
Post by: Pikoko on May 06, 2009, 09:39:15 21:39
Hi everyone.

last year i was making a serial device using pic basic pro and this year i wanna update it but im running into some issues.


i have a program that out puts strings of hex like so "FF 00 00 00 00 FF FF 00 00 00 00 FF" each hex is a channel from 1-12

i want the device to be able to read this.

i dont have a programmer anymore so iv been trying to use pic simulator IDE.

my question is.


Code:
SerialBuffer var BYTE[12]

SERIN2 rs232_in, 84 [wait(SerialBuffer)]

     if Serialbuffer[0] = 255 then
     high portb.7
     pause 200
     low portb.7
     endif

would that work for grabbing that whole string and storing it? is that also the right way to read them in an if statement?


Title: Re: pisbasic serial help
Post by: falcon _bd on May 07, 2009, 08:26:45 08:26
Code:
SerialBuffer var BYTE[12]
SERIN2 rs232_in, 84 [wait(SerialBuffer)]

This line dont do anything.


Code:

EEphone var byte[14]

SerIn2 rxd,Baud,[wait("hello"), str eephone\14]

The line always wait for  "hello" .If it gets hello first then it will grab the next 14 byte in eephone