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 - Recieving a Serial String Example

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

Recieving a Serial String Example (by Frank Mc Alinden)
Hi Jonathan

Firstly thanks for creating this program and making it available for others....

I was wondering if its possible to receive a serial string instead of a single character and if so could you please supply some sample code....
What i intend to do is use a pic16f877 as a controller to read the status of moisture probes connected to the available analogue inputs...Software running on a pc will request the status of one of the analogue inputs and i need to write some logic to capture the request as it could be one of eight inputs..
Thanks
Frank
Mon Jul 13 2009, 04:06:11
(no subject) (by Jonathan Westhues)
There's no equivalent to the "formatted string over UART" op for serial input.

But you can still process a multi-character received command. You just have to write the logic yourself, as in the attached example. Type "1" to set Yout1, "2" to set Yout2, "10" to clear Yout1, or "20" to clear Yout2.

Depending how long your commands are, that code might get somewhat complex. You can test it in the simulator; characters that you type in the terminal window will get received by the simulated UART.
Mon Jul 13 2009, 04:32:31, download attachment serial_multi.ld
(no subject) (by Frank Mc Alinden)
Thanks Jonathan , i,ll give that a try...I intend to keep the commands short....

Frank
Mon Jul 13 2009, 05:03:47
(no subject) (by Frank Mc Alinden)
Hi Jonathon

I got my app working using your sample code but i had to drop the baud rate to 2400 to receive multiple characters...I tried lowering the scan time to 1ms but that didnt help...I take its not possible to have higher baud rates..??
Thanks
Frank
Wed Aug 26 2009, 03:53:26
(no subject) (by Jonathan Westhues)
LDmicro reads the UART every cycle time. This means that if two characters come in less than a cycle time apart, then one will get lost.

At 2400 bits/s, you get roughly 240 characters per second max, or roughly a character every 4 ms. So a 1 ms cycle time is okay, but a 10 ms cycle time might not be, for example.
Wed Aug 26 2009, 04:05:13
(no subject) (by Alankrita Das)
I WANT A LADDER PROG. WHICH WILL SEND A SINGLE CHAR. INTO UART AND STOP THE PROCESS.
Fri Jun 5 2015, 00:45:40
(no subject) (by MGP)
Here you have a program that does what you resquest.

Please, next time start a new topic.
Fri Jun 5 2015, 06:37:16, download attachment Send one char .ld
Help (by Georges karimeh)
How i can connect my pic 16f877a with serial plz help
Fri Sep 25 2015, 01:48:32
?? (by David)
Can i change value counter with uart if i have a counter ctu count to 10 can i send uart to to change 10 value to 20 ???
Fri Sep 25 2015, 01:52:16
uart send & receive (by Mukesh Pandey)
Sir,
I have made transmitter programs for sending 5 digital inputs to a distant location
& made receiver program to receive the above signals. But it is not working. please check & suggest any error from my side
MICROCONTROLLER used----16F886
baud rate 2400, cycle timing---10 ms, crystal freq---4Mhz

Thanks & Regards
Mon Jun 5 2017, 08:26:40, download attachment uart receiver.ld
(no subject) (by Mukesh Pandey)
TRANSMITTER PROGRAM
Mon Jun 5 2017, 08:28:03, download attachment uart transmitter 5 digital inputs.ld
(no subject) (by MGP)
Here you have your files for transmitting and receiving 5 char and set or reset the outputs.
Mon Jun 5 2017, 13:12:10, download attachment uarttransmitter5digitalinputs.zip
(no subject) (by MGP)
I made a mistake in rung 4 in the send - file, now it's the good version.
Mon Jun 5 2017, 13:17:19, download attachment uarttransmitter5digitalinputs_V2.zip
uart send & receive (by Mukesh Pandey)
Sir it is not working. please check the simulation in transmitter, I find the uart tx values are not changing. I do not have oscilloscope, is it possible to check the transmitter & receiver.
shall I connect the transmitter tx pin (17) to receiver rx (18) of microcontroller (16F886) by wire & observe the data transmission & reception
Thanks & regards
Tue Jun 6 2017, 12:19:16
(no subject) (by MGP)
You have to look in the window below, it's changing from 0 to 1.
This is because of the OSR instruction.
Tue Jun 6 2017, 12:36:04
Como guardar en la memoria Flash (Cuando se desconecta el micro y se vuelve a conectar no pierda la memoria) (by Paulino Cano)
Hola necesitaría como guardar la memoria de una variante en la memoria del micro para cuando se reama el micro sepa que cuando le damos la energia sepa en que programa hactuar.
Ejemplo:tengo un Sumh que tiene 3 niveles 1º nivel (analogo) 300,2º Nivel 400, 3º nivel 500. le ago 3 programas Programa_1, Programa_2, programa_3.
con 2 entradas pulsandolas a la vez y al paso de un tiempo se ban activando ls programas. y que me encuentro que cuando le quito la alimentacion al conectar le tengo que volver a conectar unos de los programas.
Fri Jun 16 2017, 11:12:33, download attachment Programa para federic.ld
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):