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

PCD: printf and putc in 4.096

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



Joined: 10 Feb 2004
Posts: 205

View user's profile Send private message

PCD: printf and putc in 4.096
PostPosted: Thu Aug 13, 2009 2:12 pm     Reply with quote

I have a simple program running just to see if my ccs development board is working. I used the pic24 wizard to get most of this and added the putc in there.

Code:

#include <24FJ128GA006.h>
#device icd=true
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES NOJTAG                   //JTAG disabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOWRT                    //Program memory not write protected
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES ICSP2                    //ICD uses PGC2/PGD2 pins
#FUSES WINDIS                   //Watch Dog Timer in non-Window mode
#FUSES WPRES128                 //Watch Dog Timer PreScalar 1:128
#FUSES WPOSTS16                 //Watch Dog Timer PostScalar 1:32768
#FUSES NOIESO                   //Internal External Switch Over mode disabled
#FUSES FRC_PS                   //Fast RC Oscillator with Post Scaler
#FUSES NOCKSFSM                 //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES NOOSCIO                  //OSC2 is clock output
#FUSES HS                       //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)

#use delay(clock=20000000,RESTART_WDT)

#use rs232(uart1,baud=9600,parity=N,bits=8)


void main()
{
   setup_spi(SPI_SS_DISABLED);
   setup_spi2(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer1(TMR_DISABLED|TMR_DIV_BY_1);
p:
//putc('A');
//putc(0x13);
//putc(0x10);
putc(0xaa);
delay_ms(1);
goto p;

   // TODO: USER CODE!!

}


I am not getting any data that makes sense in SIOW. If I look at on scope the 1's are around .54ms wide. So I put a special baud rate of 1851baud in SIOW and I can sometimes see 0xAA in my data window. What can I be doing wrong here? Thanks.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Aug 13, 2009 3:42 pm     Reply with quote

Your current oscillator setting is "Fast RC Oscillator with Post Scaler", so the clock frequency can never be 20 MHz. #FUSES PR or PR_PLL selects the primary oscillator.
Guest








PostPosted: Fri Aug 14, 2009 12:40 pm     Reply with quote

Hi

Hints

Remove both:
Code:
setup_spi(SPI_SS_DISABLED);
setup_spi2(SPI_SS_DISABLED);
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Aug 14, 2009 1:08 pm     Reply with quote

The said setup_spi() statemenst are actually enabling the SPI interface, which is most likely unintended. But they are of course not related to the reported baud rate issues.
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