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.

Uart 16F877A little help needed

Status
Not open for further replies.

maria258

Member level 2
Joined
Feb 10, 2011
Messages
42
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Activity points
1,577
Dear all,
I tried some coding for transmitting and got a voltage return from my PIC, swinging between 1.25V to 1.16V and back. Do you think this is correct? my code is attached below.

thanks

Code:
#include <htc.h>    //header file for Pic Micro
 #include <stdlib.h>
 
 __CONFIG (0x3F72);    //configuration fuses PIC16F877 from software
 
 void init(void);
 void transmit(void);
 
 void main()
 {
 init();
 transmit();
 while(1);
 }
 
 void init()
 {
 unsigned int count;
 PORTC=0x00;
 TRISC=0xFF;
 
 TXSTA=0b001000110;
 RCSTA=0b10010110;
 
 SPBRG=0b01000000;
 INTCON=0b11000000;
 PIR1=0b00010000;
 PIE1=0x00;
 
 count=0;
 }
 
 void transmit()
 {
 while(1)
 {
 TXREG=0x00;
 PIE1=0x00;
 }
 }

i only read the voltage by a multimeter. still have to make the hardware to plug it with my pc. the actual problem is the coding that worries me cos then i need to interface with a graphic lcd.
 

no i am not aiming of doing that. i am using pic16f877a that will eventually be a portable device with a graphic lcd. for the moment though, i will be trying to do this level converter (**broken link removed**) just to see what is the output of the analog signal being inputted in the chip.
 

oh wait... my projectconsists of having an analog sensor, passed to pic, then outputted to my graphic lcd. now, all im doing at the moment is have the output transported to the uart to the pc. the coding is where i fear i might be wrong.
 

in the code what is the use of while(1); when in tx function you are running a while(1) infinite loop, when will program come to while(1); it would never reach........

you are not transmitting any data int he program also and nor waiting for the interrupt flag to set or anything.. without transferring the data how do you see the data or the voltage levels..??

correct me if i am wrong....................
 

ok then i will change that but the problem that arises as well, can i check with a multimeter and get a good reading? and what are the voltage swinging values that i need to check for it to be working properly?
 

for max232 signal analysis multimeter will never help........ it cannot change as fast as the signal changes as the resolution is less... a good scope will do all your work.......
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top