(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
(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.
(no subject) (by Frank Mc Alinden)
Thanks Jonathan , i,ll give that a try...I intend to keep the commands short....
Frank
(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
(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.
(no subject) (by Alankrita Das)
I WANT A LADDER PROG. WHICH WILL SEND A SINGLE CHAR. INTO UART AND STOP THE PROCESS.
(no subject) (by MGP)
Here you have a program that does what you resquest.
Please, next time start a new topic.
Help (by Georges karimeh)
How i can connect my pic 16f877a with serial plz help
?? (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 ???
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
(no subject) (by Mukesh Pandey)
TRANSMITTER PROGRAM
(no subject) (by MGP)
Here you have your files for transmitting and receiving 5 char and set or reset the outputs.
(no subject) (by MGP)
I made a mistake in rung 4 in the send - file, now it's the good version.
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
(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.
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.
Post a reply to this comment:
|