From: "Matt Foster"
Subject: Re: Need RS232 code for PIC
X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
Date: Fri, 3 Jan 2003 22:37:37 -0000
NNTP-Posting-Date: Fri, 03 Jan 2003 22:37:32 GMT
Organization: blueyonder (post doesn't reflect views of blueyonder)
I'm now using http://matthewfoster.myby.co.uk/lousyattempt2.jpg
"Peter Bennett" wrote in message
> On Fri, 3 Jan 2003 18:52:23 -0000, "Matt Foster"
> >Hi, I have another thread (RS232 newbie - in need of assistance!)
> >Now I have a circuit (I think) that works
> >I need some code for my PIC that will detect which of SW1,2,3,4 or 5 was
> >pressed, and output an appropriate character in RS232.
> >Please help me, I have no knowledge of C or PICs or anything.
> I would have a small loop that would repetetively read the switches,
> and compare the value read to the previous value. If the two are
> different, add 30 hex (an ASCII 0) to the current value, and send that
> out the serial port.
> Adding 30 hex to the switch value ensures that the character the PIC
> sends is printable, so you can look at the data with a terminal
> program to verify the PIC is doing what you want before you start
> worrying about your PC program.
> By sending the current state of all five switches to the PC, you leave
> any (possibly changable) decision making in the PC program, where it
> will be more easily changed.
> Peter Bennett VE7CEI
> GPS and NMEA info and programs:
> Newsgroup new user info: http://vancouver-webpages.com/nnq
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.434 / Virus Database: 243 - Release Date: 25/12/2002