Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[MOVED] i want tho take input from a switch and display message pls help me out

Status
Not open for further replies.

sachitmenon14

Newbie level 2
Joined
Sep 11, 2016
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
18
I am using pic18f4550 and i am new to programing pls help me with the code of taking input from a switch and displaying data when switch is pushed
 

Hello!

First, there are many things we need to know to answer.
The only accurate information is PIC18F4550
- Where and how do you want to display data? On an LCD? What kind of LCD?
On a 7 seg display? Etc...
- Are you using a PIC board (standard), or is it a home brew hardware? In this latter
case, where is the switch wired and how? Pull up or down?

Now if you are using a standard board, you can certainly find some code and start from there.
And once you wrote, compiled and loaded the program on your target, tell us accurately
what works and what doesn't.

As you are new to programming, you should start with simple tasks before doing this.
Are you able to blink a LED? If yes, are you able to write a number on a 7 seg display?

ETC...

What I mean is that nobody is going to make your homework for you, you have to pull
your hands out of your pockets, roll your sleeves and do something.

Dora.
 
Also what programmer are you using, what IDE and what programming language?
Susan
 

Thank you guys for the help i figured it out and got the output as needed.
now i am looking forward to interface gsm and gps to the the same pic but i am confused as pic18f4550 has only 1 tx,rx and do i need to use rs232 and max232?? pls help me!!!
 

Back on the original topic, make sure that you debounce the switch input or you will get a lot of spurious triggers.
As fr the PIC18f4550 having one EUSART, that is correct but adding in the RS232 and MAX232 parts to the question shows that you don't quite understand what they are.
RS232 is a transport layer protocol which means that it defines the voltage levels that the '1's and '0' have on the wire. Typically a '1' will be represented by a voltage between -15V and -3V - the key thing to note here is that the voltage is negative. A '0' is represented by a positive voltage form +3V to +15V.
Now if you put those voltages directly onto the PIC then you can easily blow it up as it is expecting voltages between 0V and Vdd (5V or whatever you are using). This is where the MAX232 comes in as it can translate the TTL level voltages the PIC expects to the RS232 voltages that are on the line.
Now, all that may be irrelevant if you are connecting to a GPS and GSM device that use TTL voltages in which case no translation is required. You need to check the data sheets to check the voltages the various devices use (as well as the sense of the logical'0' and '1' signals).
Therefore none of this gets around the problem of only having one EUSART on the PIC18F4550. You need to look to another device that has 2 UARTS or you need to look at bit-banging a UART. Bit-banging can be a bit tricky for receiving (it is much easier for sending as timing is important but not as tight as for receiving) but it is certainly possible if you have the CPU time to spare.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top