PDA

View Full Version : Serin / Serin2 / Debugin Differences



jamie_s
- 19th January 2006, 04:34
I've read on these forums, peoples opinions to use Serin, Serin2, or debugin for different applications.

Can someone give me a quick rundown on the differences between the three - which one has what advantage, purpose better suited to etc?

Also, one project im working on uses a pic to listen to data being sent via a serial port, and upon a certain character sequence of 6 characters, will either switch a relay on or off.
Upon testing with hyperterminal sending a text file to the serial port, if the text file only contains the character sequence and nothing else, it switches fine, but once the sequence characters are embedded within random text, the pic does not catch the sequence and switch the relay.
Data is @ 9600 bps, PIC16F628A @ 4 and at 20 mhz, the problem is there. Should I be using serin2 or should i be checking the data differently



loop:


DEBUGIN 10000,loop,[WAIT("-RLY_O"), TriggerChar] ' TriggerChar = input character: o'N' or o'F'f in 10 sec

If TriggerChar = "N" then PwrON
If TriggerChar = "F" then PwrOFF


Thanks

mister_e
- 19th January 2006, 06:32
If the PIC (as your F628) have an internal USART, i'll use it and keep code smaller. Of course you'll need additionnal hardware like MAX232 between the PIC and the PC. BUT using DEBUG, SEROUT,SEROUT you will not need it if you set to INVERTED mode.

SEROUT2 have almost the same function as DEBUG. The main difference is that DEBUG don't allow multiple i/o, work on a fixed baudrate BUT produce a tighter code and faster baudrate when using slow speed crystal like 4 MHZ.

SEROUT is... really limited but allow multiple serial pins, different baudrate.