Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC to PIC and output on LCD

Status
Not open for further replies.

pouchito

New Member
Hi All,

Please i need your help to write this code:

I am using two PIC16F877A, 1 push buttom and 1 LCD 2*16.

the input of the first PIC is a push buttom,
the first PIC is connected to the second PIC using a Wire later on i will put a transmitter and receiver.

what i m trying to do is that when i press on the push buttom -> a sentence will be written on the LCD whihc is connected on the second PIC.

I need to write the code for the 2 PIC using PICbasic or assembly.

Please help me

Thanks in advcance
 
pouchito said:
Hi All,

Please i need your help to write this code:

I am using two PIC16F877A, 1 push buttom and 1 LCD 2*16.

the input of the first PIC is a push buttom,
the first PIC is connected to the second PIC using a Wire later on i will put a transmitter and receiver.

what i m trying to do is that when i press on the push buttom -> a sentence will be written on the LCD whihc is connected on the second PIC.

I need to write the code for the 2 PIC using PICbasic or assembly.

Please help me

Thanks in advcance

Hi,
May I ask why you want to use to mid range PIC's, one to read a switch and the other to drive an LCD???

One 16F877A would do both jobs quite easily?

If you are using a TX/RX radio link, why not just TX the button push??
 
ericgibbs said:
Hi,
May I ask why you want to use to mid range PIC's, one to read a switch and the other to drive an LCD???

One 16F877A would do both jobs quite easily?

You need two (although you don't need 16F877's), because of the radio link.

If you are using a TX/RX radio link, why not just TX the button push??

You need to encode the data transmission.

Everything he needs is covered in my tutorials, in assembler.
 
Nigel Goodwin said:
You need two (although you don't need 16F877's), because of the radio link.



You need to encode the data transmission.

Everything he needs is covered in my tutorials, in assembler.

I was just thinking in terms of simple TX burst when the button was pushed, no data encoding,
likewise at the RX just detect the burst output from the receiver.


EDIT; Unless he wants to TX 'different' messages, he dosn't say, yet.
 
Last edited:
Thanks for your help,

I don't mind if i used other than the PIC16F877
but i must use two because i don't have only the push button , this is only a part of my project.

I will check nigel's tutorial, but can you help me to start writing the code pls ?
 
ericgibbs said:
I was just thinking in terms of simple TX burst when the button was pushed, no data encoding,
likewise at the RX just detect the burst output from the receiver.


EDIT; Unless he wants to TX 'different' messages, he dosn't say, yet.

You can't just send a burst of carrier - the receiver would be triggered by any click or pop in the atmosphere - data encoding is absolutely essential.
 
pouchito said:
Thanks for your help,

I don't mind if i used other than the PIC16F877
but i must use two because i don't have only the push button , this is only a part of my project.

I will check nigel's tutorial, but can you help me to start writing the code pls ?

hi,
In your first post you said 16F877A and this post 16F877 ??

If you download Nigel's tutorials, I dont think he would mind if you used them
as a learning template, then 'cut/paste' code fragments into your own listing.
There is no point in writing new code when existing proven subroutines can be used.

Keep your code in a modular format, so that you can add tested subroutines.

Goto www.microchip.com and download the free MPLAB IDE V7.xx also get a 16F877? datasheet and application data for that PIC.
The MPLAB has templates for most of the PIC types, use a template as the
framework for your code.

If you attempt to write the code yourself and then post, members are more likely to help you sort it out.

Regards
 
I checked the tutorial 13 of Nigel's tutorial (EXCELLENT TUTORIAL :D)
I will compile the asm code right now TUT12-3T and TUT12-3R and simulate them

But need your help to interface an LCD cz it s a bit hard using the assembly as i see
 
Nigel Goodwin said:
You can't just send a burst of carrier - the receiver would be triggered by any click or pop in the atmosphere - data encoding is absolutely essential.

hi Nigel,
When I said a 'burst' I was being over simplistic, I would make it a modulated 'burst' of some known duration.

It now appears that the OP has to use two PICs as part of the assignment.

I suspect he requires to transmit different text messages which bursts the burst bubble! :rolleyes:
 
Please Nigel help me,
in the hardware part of your tutorial you have mentioned that the RA6 of the PIC in the transmitter part must be connected to the RA7 of the receiver part.

In the pic 16f628 the pin 15 is at the same time RA6 and osc2

if i used it i can't include any crystal oscillator !
am i right? pls correct me
 
pouchito said:
Please Nigel help me,
in the hardware part of your tutorial you have mentioned that the RA6 of the PIC in the transmitter part must be connected to the RA7 of the receiver part.

In the pic 16f628 the pin 15 is at the same time RA6 and osc2

if i used it i can't include any crystal oscillator !
am i right? pls correct me

Just use a different pin, and alter the equates accordingly.
 
Thanks again.

so if i omit the crystal and capacitor (of the closck), the circuit won't work right ?

FACING A PROBLEM, pls help:

I changed the portA.6 to PortA.0 and of course the receiver part also from 7 to 1, added the 4MHZ crystal and the capacitors but the simulation is not working :'(

What i have to modify to make it work ?
 
Last edited:
pouchito said:
no, because i don't know how to do it :S


I know I am gonna get shot down here.... :eek:

PICBASIC is your friend. So much easier than assembler to learn...
I use Proton Plus, and love it..


SHAX
 
it s true that picbasic is easier than the asm,but my problem is that the other part of my project are written using asm :S
 
For most small applications, there is no need for encoding the data. It's a fiar bit of overkill, and there are many radio modules that simply run with UART data as they encoded/decode it on the fly


I take it your using Proton still? In that case, have a look at this code'

TX;
Code:
[FONT="Courier New"]Device = 16F628A

Symbol Key = PORTA.0                 ' Define which Pin the Button is on

' Start of program;
ALL_DIGITAL = True                   ' Make all I/O's digital

Input Key                            ' Make the Key pin an input

While 1 = 1                          ' Create an infinate loop
    RSOut "Header", Dec Key, "Z"     ' Send the current status of the key
    DelayMS 100                      ' Delay for 100mS
Wend                                 ' Loop for ever[/FONT]


RX
Code:
[FONT="Courier New"]Device = 16F628A

Dim Key As Bit                              ' Define a register for the Key data

' Start of program...  
ALL_DIGITAL = TRUE                          ' Make all I/O's digital
Low PORTB.1                                 ' Set up the IDLE state of the RSIn_Pin

While 1 = 1                                 ' Create an infinate loop
    RSIn Wait("Header"), Key                ' Wait for the text "Header", then grab the key data
    If Key = 1 Then                         ' Check if the key was pressed or not
        Print At 1, 1, "Key is Pressed"     ' If it was then display this text
    Else
        Print At 1, 1, "Released      "     ' Else if it wasn't then display this text
    EndIf
Wend                                        ' Loop for ever[/FONT]

uart-and-button-example-png.13113


Click here to watch this program and circuit simulated
 

Attachments

  • UART and button example.PNG
    UART and button example.PNG
    14.9 KB · Views: 313
Last edited:
Hi,
Since this thread is about LCD, I have one question here.
Usually the Vee pin is connected to a potential meter to adjust the contrast. I found that if I supply the LCD with 3 V, the contrast is suit to me when the variable resistor is fully turned, which is ground level to Vee pin. If I connect this pin directly to ground without any current limiting resistor, is it okay?

Thanks
 
bananasiong said:
Hi,
Since this thread is about LCD, I have one question here.
Usually the Vee pin is connected to a potential meter to adjust the contrast. I found that if I supply the LCD with 3 V, the contrast is suit to me when the variable resistor is fully turned, which is ground level to Vee pin. If I connect this pin directly to ground without any current limiting resistor, is it okay?

Thanks


I usually only put on the bare minimum when simulating, and using Proteus a fair bit allows me to know a lot of the “back doors”. Makes things look a lot neater and smoother. For Vee (Contrast), connect a 4.7K to 47K potentiometer like this to it. Now you have complete control over the contrast of the LCD.
**broken link removed**

Dont wire it directly to ground or 5V, as they are both opposite (full and low) limits of the contrast
 
Last edited:
pouchito said:
no, because i don't know how to do it :S

Either read the datasheet (which tells you how), or check my tutorials which have a page telling you how to change from the 16F628 to the 16F877/6



It's also pretty important to encode the data via a radio link, it makes it far more reliable and prevents many problems.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top