|
|
View previous topic :: View next topic |
Author |
Message |
uni_student
Joined: 01 Aug 2007 Posts: 38 Location: AUckland, NEW ZEALAND
|
Internal Oscillator |
Posted: Thu May 28, 2009 1:33 am |
|
|
Hi, using PIC16F716 just to turn LED on, when high input on any b port pins, and then send a specific character onto UART. Tried with uart program and LED not even blinking, or LED stays on continuously. Commented UART stuff out and LED does the same thing.
I am using the internal oscillator so am wondering if I'm doing anything wrong in the code for that feature. Have checked circuit over many times and all is good.
Any help appreciated!!!
Code: |
#include <16f716.h>
#fuses HS,NOWDT,NOPROTECT
#include <string.h>
#use delay(clock=4000000)
//#use rs232(baud=9600, xmit=PIN_B3, parity=N, bits=8, INVERT, ERRORS)
#define LED PIN_A1
#define data PIN_B3
void main(){
output_high (LED);
//port_b_pullups(TRUE);
output_low(data);
delay_ms(1000);
output_low (LED);
while (TRUE){
if(input (PIN_B0)){
//putc('a');
output_high(LED);
delay_ms(500); //switch debounce
output_low(LED);
}
if (input (PIN_B1)){
// putc('b');
output_high(LED);
delay_ms(500); //switch debounce
output_low(LED);
}
if(input (PIN_B2)){
// putc('c');
output_high(LED);
delay_ms(500); //switch debounce
output_low(LED);
}
if (input (PIN_B4)){
// putc('1');
output_high(LED);
delay_ms(500); //switch debounce
output_low(LED);
}
if (input (PIN_B5)){
// putc('2');
output_high(LED);
delay_ms(500); //switch debounce
output_low(LED);
}
if(input (PIN_B6)){
// putc('3');
output_high(LED);
delay_ms(500); //switch debounce
output_low(LED);
}
if (input (PIN_B7)){
// putc('?');
output_high(LED);
delay_ms(500); //switch debounce
output_low(LED);
}
}
} |
|
|
|
Ttelmah Guest
|
|
Posted: Thu May 28, 2009 2:28 am |
|
|
You are not using an internal oscillator....
'HS' fuse, means use external high speed crystal.
The 16F716, _does not have an internal oscillator_......
You need to switch to a chip that has an internal oscillator block, or add an external crystal. For a 4Mhz crystal, the fuse would be 'XT'.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|