parts-man73
New Member
I have a Junebug and I decided to give C programming a try on the 18F series.
I programmed the onboard 18F1320 without issues with a simple LED blinker.
I had a 18F2455 around from another project (one that provided a HEX file, so I didn't write the code myself). I plugged it into a breadboard, and jumpered the programming and power wires to the breadboard.
The code builds successfully, and the PIC programs successfully, but I do not get the intended results. I want to turn on RB0, which I have an LED properly attached to.
First of all...I'm wondering, since I'm not utilizing the USB, is a crystal required, as I just want to use the internal oscillator?
btw...I manually set the configuration bits in MPLAB to make PORTB all digital I/O, until I figure out the correct way to do it in code.
I try to set the OSC with
but the compiler kicks out "Error [1224] configuration setting 'OSC' not recognized"
Any good references to where to look for #pragma config settings? and just general C help? I've looked at a few tutorials I found with Google, including 3vO's tutorial that are in development. I've never used C before, but I have programmed in other langauges, including some assembler, Pascal, basic and other similar.
Thanks in advance,
Brian
I programmed the onboard 18F1320 without issues with a simple LED blinker.
I had a 18F2455 around from another project (one that provided a HEX file, so I didn't write the code myself). I plugged it into a breadboard, and jumpered the programming and power wires to the breadboard.
The code builds successfully, and the PIC programs successfully, but I do not get the intended results. I want to turn on RB0, which I have an LED properly attached to.
Code:
// My first C program */
#include <p18f2455.h>
#pragma config WDT = OFF
void main(void)
{
TRISB = 0b00000000;
PORTB = 0b00000001;
while(1);
}
First of all...I'm wondering, since I'm not utilizing the USB, is a crystal required, as I just want to use the internal oscillator?
btw...I manually set the configuration bits in MPLAB to make PORTB all digital I/O, until I figure out the correct way to do it in code.
I try to set the OSC with
Code:
#pragma config OSC = INTHS
Any good references to where to look for #pragma config settings? and just general C help? I've looked at a few tutorials I found with Google, including 3vO's tutorial that are in development. I've never used C before, but I have programmed in other langauges, including some assembler, Pascal, basic and other similar.
Thanks in advance,
Brian