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.

Uart 16f877a

Status
Not open for further replies.

maria258

New Member
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.
 
You won't get a true reading with a multimeter.. The transmission is so fast the mulitmeter will only get a fraction of the voltage on the pin... you need to look at the signal with a scope or logic analyser..

The voltage you are seeing will be about right for the time ON / OFF .

Ian
 
That's not a serial graphical display unit. Its a normal KS0108 chipset! What are you using the uart for?

hi Ian. [morning]
Are you sure about that.?
**broken link removed**
 
Am I missing some thing Eric.. It looks like a normal KS0108 (PARALLEL) LCD to me...
Oh yeah ... Morning..

I 'think' the UART is for another section of the project, not the Glcd.??? Is that correct maria.????:confused:
 
to my way of thinking, it is to send data from the pic16f to the glcd.....

hi Ian,
3v0 advised me that the UART is part of the Debug feature in the circuit debug compiler,,, to help test the Glcd code.
 
You know that you are only sending 0's right? Also you are constantly flooding the TXREG, you need to wait until data has been shifted out before loading TXREG again.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top