(you are viewing a thread; or go back to
list of threads)
Beginner! Number to send between 16F628 to a 16F877 via serial (by Heiko Kraft)
Moin!
I have to send a 3 letter number between a 16F628 and a 16F877, butt everything that I try will not work.
When I send a number between 1 and 8, no problem, but only when I write it like '1'. The number 1 to 8 have I send over UART Send.
Then I try "Formatted String over UART" but I´m not sure how the to write the instruction correct.
Maybe someone can help.
Both short programms attached.
Thank you!
(no subject) (by MGP)
Here's an example program to receive 12 bytes + 1, you only need 3 + 1 (prefix) bytes because each number consists of 3 digits (<=999).
The first byte must be XFE and the following bytes are the data bytes.
Each new number must be preceded by XFE (Dec 254), this is a counter reset to receive the following bytes.
You dont need to send \r\n
This will give you an idea how to do that.
And you must program this program yourself, if you do not understand how to do this, then it's hopeless.
But you may still ask questions.
(no subject) (by Heiko Kraft)
Hi MGP,
Thank you very much for your support!
OK understand.
So the TX in my 16F628 have to send the XFE (254) first of each new byte.
Have I to send via "Formatted String over UART" or just "SEND UART". When I send over "Formatted String" I had try (a) a=\3 for the 3 numbers in a byte.
Is that the right way?
Thank you!
(no subject) (by MGP)
I changed you program for testing.
You can see that X8 is a NC closed contact, so Eingang = 128
You have to change that when using your program.
Its sending hex FE and 128, this are 4 digits.
Play whith this example so you can understand it.
(no subject) (by Heiko Kraft)
Thank you very much for your support!
I understand what you done and what is happening, I will test it next week at home, i am on work for the next days.
Excuse me for maybe stupid questions...
I´ll make short and the first steps in electronic and PIC programming.
Last for now, can I connect another PIC to the serial connection or does it only work with two.
Thanks!
(no subject) (by MGP)
You can control every UART device, even communicate with your PC, subject to respect the voltage levels and baudrate.
Also all μcontrollers supported by LDmicro and others with another programming language.
(no subject) (by Boris)
Hi MGP
Communicate with PC sounds very interesting.
Can You please explain how and what I need to do something like that.
Thanks
(no subject) (by Heiko Kraft)
Dear MGP,
OK that works! Thank you.
What can I now do when I want to send 4 letter number? up to 8768?
Thanks for you Support!
(no subject) (by MGP)
This is easy, change in rung 13
Eingang "{\4}"
Or 5 digits
Eingang "{\5}"
(no subject) (by Heiko Kraft)
Oh, that´s sounds realy easy.
Is there a problem when I have {\4} and I´m sending just three letters like 889?
or must it then be up from 1000?
(no subject) (by MGP)
The output is formatted, the pic always send four characters at \4 , even when you send the number 1
I do not know what is sent for leading zeros is but you can easily get around that, by examining the character received.
I am building a new testboard, for the moment i can't help you with this.
Post a reply to this comment:
|