Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Serial Recieving Issue

(you are viewing a thread; or go back to list of threads)

Serial Recieving Issue (by Frank Mc Alinden)
Hi Jonathon

I have written some serial logic for receiving which works fine if i use the simulator but connected to Hyper terminal doesnt work....The pic receives a query command such as"QA1" which means query analogue 1 ....Using the simulator it works fine but i can only get the pic to transmit analogue 1data serially if i just allow it to trigger on receiving a single character such as "Q" ....Im guessing that the data is arriving too fast ??(im assuming hyperterminal transmits once CR is pressed)...have attached a copy of my ladder diagram ...any ideas please...
Thanks
Frank
Wed Jul 22 2009, 05:04:16, download attachment Moisture_Monitor.ld
(no subject) (by Jonathan Westhues)
Most terminal programs will send the keys as soon as you type them, without waiting for you to press Enter. But you are correct that it would be a problem if the characters were somehow coming too fast. Things will break if you get more than one character per cycle time. At 9600 bps, that corresponds to ~1 ms cycle time.

There's a mistake in the example that you posted; char_in gets compared against 1 (the integer), not '1' (the ASCII code). So the QA1 command won't work in any case.

I'm not sure if either of those are your problem. But I've also attached what may be a simpler way to do the multiple ADC channels, with less code.
Wed Jul 22 2009, 05:39:53, download attachment adc-multich.ld
(no subject) (by Frank Mc Alinden)
Hi Jonathan

Thank you very much for your speedy response and sample code..
The error in my code was due to editing to get it to work...
Your code had done the trick ....and it has reduced my code size from 34% to 13%...;-)(fantastic !!...Using a shift register did cross my mind but wasnt sure how to implement it....

I need to be careful when reading the analogue inputs as they will be connected to probes in the soil and if i leave power on them the probes will corrode...I intend to use an output connected to pull ups an all analogue inputs and only apply power when required to report the status of a probe....

Thanks again
Frank
Wed Jul 22 2009, 06:13:17
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):