|
|
View previous topic :: View next topic |
Author |
Message |
zilog
Joined: 17 Aug 2007 Posts: 19
|
basic hello world fails with 3.249 compiler and pic18f6722 |
Posted: Sat Aug 18, 2007 7:25 am |
|
|
As the topic states, the simple example below fails using CCS 3.249 with a PIC18F6722. It seems like the oscillator doesnt start at all (this MCU ran with this compiler before, using other code, so the MCU itself should be fine). What have I done wrong?
Code: |
#include <18F6722.h>
#pragma case
#device HIGH_INTS=TRUE
//#device ICD=TRUE
#priority EXT3, TIMER2, TIMER1, RB
#fuses H4, NOWDT, STVREN, NOXINST, NODEBUG, NOXINST
#define PLL40
#ifdef PLL40
#use delay (clock=40000000)
#else
#use delay (clock=10000000)
#endif
|
Code: |
#include "styrkort.h"
#use fast_io(F)
void main(void)
{
unsigned int8 underVoltage;
while (1) {
output_high(PIN_D1);
delay_ms(1);
output_low(PIN_D1);
delay_ms(1);
}
|
|
|
|
Ken Johnson
Joined: 23 Mar 2006 Posts: 197 Location: Lewisburg, WV
|
|
Posted: Sat Aug 18, 2007 8:07 am |
|
|
If you use fast_io, you must set the tris register to make the pin an output. Currently it's an input, so you won't see it toggle, even though your code is running.
Ken |
|
|
zilog
Joined: 17 Aug 2007 Posts: 19
|
|
Posted: Sat Aug 18, 2007 8:16 am |
|
|
Ken Johnson wrote: | If you use fast_io, you must set the tris register to make the pin an output. Currently it's an input, so you won't see it toggle, even though your code is running.
Ken |
The F-bank is fast, D is not. |
|
|
Ttelmah Guest
|
|
Posted: Sat Aug 18, 2007 9:03 am |
|
|
Are you uing a low voltage programmer?. If not, you need NOLVP, or if the lines for this are floating, the chip may not start.
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
|