Hi,
I have a concern and a problem using the internal osc for pic18f4550. I am trying to do a rs-232 connexion on my pc (the hardware is in place...max 232 etc..) and I am bugging at finding the osc speed using this configuration: #pragma config FOSC = INTOSCIO_EC. I need to assign a value to BRG, but I couldn't find a concrete value for the FOSC.
Furthermore, in my initial schematic design, I planned on using a external oscillator, but I am currently working without it. Do you think it is a good idea to have a external oscillator? I know that 18f4550 were designed to get a much more stable internal clock.
here is the current code I have:
#pragma config WDT = OFF //Disable watchdog timer
#pragma config LVP=OFF
#pragma config FOSC = INTOSCIO_EC
#include <p18f4550.h>
#include <delays.h>
#include <usart.h>
#include <stdio.h>
#include <stdlib.h>
void portConfig(void);
void relaysInit(void);
void eusartConfig(void);
void main(void)
{
portConfig();
relaysInit();
TXSTA = 0b00100100;
RCSTA = 0b10010000;
BAUDCON = 0b01000000;
SPBRG = 42; // probly faulty value!
bankEnable();
bankAToggle();
while (1)
{
//Write data
TXREG='B';
}
}
Simon
I have a concern and a problem using the internal osc for pic18f4550. I am trying to do a rs-232 connexion on my pc (the hardware is in place...max 232 etc..) and I am bugging at finding the osc speed using this configuration: #pragma config FOSC = INTOSCIO_EC. I need to assign a value to BRG, but I couldn't find a concrete value for the FOSC.
Furthermore, in my initial schematic design, I planned on using a external oscillator, but I am currently working without it. Do you think it is a good idea to have a external oscillator? I know that 18f4550 were designed to get a much more stable internal clock.
here is the current code I have:
#pragma config WDT = OFF //Disable watchdog timer
#pragma config LVP=OFF
#pragma config FOSC = INTOSCIO_EC
#include <p18f4550.h>
#include <delays.h>
#include <usart.h>
#include <stdio.h>
#include <stdlib.h>
void portConfig(void);
void relaysInit(void);
void eusartConfig(void);
void main(void)
{
portConfig();
relaysInit();
TXSTA = 0b00100100;
RCSTA = 0b10010000;
BAUDCON = 0b01000000;
SPBRG = 42; // probly faulty value!
bankEnable();
bankAToggle();
while (1)
{
//Write data
TXREG='B';
}
}
Simon
Last edited: