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 - Beginner! Number to send between 16F628 to a 16F877 via serial

(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!
Mon Oct 27 2014, 02:54:02, download attachment 16F628_Erw.zip
(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.
Mon Oct 27 2014, 16:04:29, download attachment Receive_12_bytes.ld
(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!
Tue Oct 28 2014, 02:51:48
(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.
Tue Oct 28 2014, 09:12:47, download attachment 16F628_Erw_v2.ld
(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!
Wed Oct 29 2014, 04:36:34
(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 &#956;controllers supported by LDmicro and others with another programming language.
Wed Oct 29 2014, 07:34:10
(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
Wed Oct 29 2014, 16:23:40
(no subject) (by MGP)
A TTL to RS232 converter is required, RS232 cable and PC software.

PC with RS232 or USB/RS232 cable
Converter = MAX232 circuit for the PIC
Software, i use Hercules, it's free: http://www.hw-group.com/products/hercules/index_en.html
Thu Oct 30 2014, 03:37:02
(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!
Fri Oct 31 2014, 15:39:56
(no subject) (by MGP)
This is easy, change in rung 13

Eingang "{\4}"

Or 5 digits

Eingang "{\5}"
Sat Nov 1 2014, 04:14:37
(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?
Sat Nov 1 2014, 13:43:39
(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.
Sun Nov 2 2014, 05:40:43
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):