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

changed from 16f877 to 18f4525 and stepper doesn't work

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



Joined: 04 Jun 2007
Posts: 27

View user's profile Send private message

changed from 16f877 to 18f4525 and stepper doesn't work
PostPosted: Tue Jul 24, 2007 4:38 am     Reply with quote

I changed from PIC 16f877 to 18f4525 and i have the same code but my stepper doesn't work anymore.
Ive measured the frequency --> its much to high on the 18f4525
The Code works on the 16f + stepper works - but of cource with an other .h file - can this be anything with the internal oscilator or something?

Code:

#include "main.h"


void main()
{
unsigned long i;

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF|ADC_TAD_MUL_0);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

Setup_Oscillator(OSC_PLL_OFF);



   // TODO: USER CODE!!

puts("Serial works");


   output_low (PIN_D6); //schaltet Motor ein
   output_low (PIN_B2); //drehrichtung
   //for (i=0;i<1000;i++)
   while (true)
   {
      output_high(PIN_B1);
      delay_us( 400 );//400 = standart
      output_low(PIN_B1);
      delay_us( 400 );
   }
}


my main.h file:
Code:

#include <18F4525.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale

#FUSES HS                       //High speed Osc (> 4mhz)

#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOIESO                   //Internal External Switch Over mode disabled
#FUSES NOBROWNOUT               //No brownout reset
#FUSES BORV21                   //Brownout reset at 2.1V
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOCPD                    //No EE protection
#FUSES NOSTVREN                 //Stack full/underflow will not cause reset
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT                    //Program memory not write protected
#FUSES NOWRTD                   //Data EEPROM not write protected
#FUSES NOEBTR                   //Memory not protected from table reads
#FUSES NOCPB                    //No Boot Block code protection
#FUSES NOEBTRB                  //Boot block not protected from table reads
#FUSES NOWRTC                   //configuration not registers write protected
#FUSES NOWRTB                   //Boot block not write protected
#FUSES NOFCMEN                  //Fail-safe clock monitor disabled
#FUSES XINST                    //Extended set extension and Indexed Addressing mode enabled
#FUSES NOPBADEN                 //PORTB pins are configured as digital I/O on RESET
#FUSES LPT1OSC                  //Timer1 configured for low-power operation
#FUSES NOMCLR                   //Master Clear pin used for I/O

#use delay(clock=12000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
Ttelmah
Guest







PostPosted: Tue Jul 24, 2007 5:06 am     Reply with quote

Before trying anything else, get rid of the XINST fuse. The CCS compiler _does not support the use of this fuse_. Wth it enabled, the odds are the code will not work properly. It is present, in case you need the instructions for soething else, but (stupidly), on some chips seems to default to being turned on...
You may well find this is all that is wrong.

Best Wishes
cyberant



Joined: 04 Jun 2007
Posts: 27

View user's profile Send private message

PostPosted: Tue Jul 24, 2007 5:30 am     Reply with quote

AH THANK YOU VERY MUCH
that was the solvation.
The Projektwizzard created this [censored]...
Now everything works fine :-)
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