CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

basic hello world fails with 3.249 compiler and pic18f6722

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
zilog



Joined: 17 Aug 2007
Posts: 19

View user's profile Send private message

basic hello world fails with 3.249 compiler and pic18f6722
PostPosted: Sat Aug 18, 2007 7:25 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Aug 18, 2007 8:07 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Aug 18, 2007 8:16 am     Reply with quote

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







PostPosted: Sat Aug 18, 2007 9:03 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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