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.

PIC 16F84A UART Problem

Status
Not open for further replies.

mr_anderson

Advanced Member level 4
Joined
Jan 23, 2007
Messages
100
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,298
Activity points
2,005
pic16f84 uart

Hi
i am using MikroC to program my 16F84A as u know it doesnot have a hardware UART pins so i am using the Soft_Uart library provided with MickroC ( it is the same provided with MikroBasic and MikroPascal ) i have programmed the PIC with a simple test program (shown below) that sends the character 'A' = 0x41 using the UART software library each 1 second.
i have connected the pin RB2 ( the serial Tx) to the MAX232 and connected it to the serial port of a the computer (pin 2) then opened the Hyper Terminal waiting to get the 'A' but i get nothing, did any one used the Soft_Uart library i mean is it reliable and is the Hyper Terminal dump or some thing like that. i supposed i have done things as it should be done but i am not getting the 'A' on the screen.
what software do u use to send, receive data on the serial port instead of the Hyper Terminal because it sucks.
any ideas, reviews, suggestions would be helpful.
Thank you.
Note: i am using a crystal oscillator of 11.0592 for the clock which should be efficient.

//----------- the PIC 16F4A program
char data=0x41;// which is the character A
void main()
{
// initialization of the UART with (8 bit, 9600 baud rate, no parity, non inverted)
Soft_Uart_Init(PORTB,1,2,9600,0);
do
{
// the PIC should send the 'A' then waits 1 second then sends it again
Soft_Uart_Write(data); // send data via UART
Delay_ms(1000); // wait 1 second
}
while(1);
}
 

16f84a uart

unsigned short data = 0, ro = 0;
unsigned short *rec;

void main() {
er = &ro;

// Init (8 bit, 2400 baud rate, no parity bit..)
Soft_Uart_Init(PORTB, 1, 2, 2400, 0);

do {
do {
data = Soft_Uart_Read(rec); // Receive data
} while (!*rec);
Soft_Uart_Write(data); // Send data via UART
} while (1);
}//~!
 

pic uart

I think i figured out the problem
you talked about 11.0592 MHZ XTAL this crystal is designed for 89C51 Architecture
for PIC architecture use just 8.0 MHz or 20.0 MHz it will work
try out some sample program
 

pic16f84a uart

Hi thank you for ur suggestion but the crystal worked just fine on the Blinking Led
 

soft_uart_read

11,095,300 MHz shoud work fine. It's 288 instructions @ 9600 baud.
Better yet stop using the ancient 16F84 and start using the newer and cheaper 16F628 which also included a USART
 

Hi,
I'm looking soft_uart library and all the other libraries needed for this library.
I want to connect with pic16F84A Siemens C55 (AT commands).
I use:
MikroC PRO for PIC;
C code.

Can you help me?
 

Hi,
I wrote this program and it worked:
Code:
char data = 'A';

void main(){
     Soft_UART_Init(PORTB, 1, 2, 9600, 0);
     Soft_UART_Write(data);
     delay_ms(1000);
     Soft_UART_Write(data);
     while(1);
}
It sends character 'A' (0x41), waits for 1second and then resends character 'A' again.
Try it.
Hope it helps.
Tahmid.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top