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 CCS Technical Support

10F206 not running.......

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



Joined: 08 Sep 2006
Posts: 182

View user's profile Send private message Send e-mail

10F206 not running.......
PostPosted: Thu Mar 25, 2010 7:17 am     Reply with quote

Hello, I am trying to get my small PIC the 10F206 to toggle some outputs.
In fact I want to control a servo.

When I connect a scope to it it doesn't show any activity.
What am I doing wrong??
Code:

#include <10F206.h>

#FUSES NOWDT                      //No Watch Dog Timer
#FUSES NOMCLR                     //Master Clear pin: disable
#FUSES NOPROTECT                  //No code protected from reads

#use delay(clock=4000000)

#byte STATUS = 0x003
#bit  DC = STATUS.1
#bit  PD = STATUS.3
#bit  TO = STATUS.4
#bit  GPWUF = STATUS.7
#byte GPIO = 0x006
#bit  GP0 = GPIO.0 //SWITCH
#bit  GP1 = GPIO.1 //FET
#bit  GP2 = GPIO.2 //SERVO
#bit  GP3 = GPIO.3 //MCLR

int1 PinChangeFlag;
int16   i;

void Init()
{
    output_high(GP1); //servo enable
}

main()
{
    PinChangeFlag = GPWUF;

    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
    setup_comparator(NC_NC);

    while(true)
    {
        Init();

                for(i=0; i <400;i++)//linksom
                {
                    output_high(GP2);
                    delay_us(500);
                    output_low(GP2);
                    delay_ms(10);
                }

            for(i=0; i <400;i++)//rechtsom
            {
                output_high(GP2);
                delay_us(1200);
                output_low(GP2);
                delay_ms(10);
            }
  }
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19546

View user's profile Send private message

PostPosted: Thu Mar 25, 2010 7:50 am     Reply with quote

The output_high instruction, expects a pin definition, _not_ a bit defintion. These are already 'in' the include file for the processor.
So your 'init' becomes:
Code:

void Init()
{
    output_high(PIN_B1); //servo enable
}

And similarly for all the other output_high, and output_low instructions.

Best Wishes
Jody



Joined: 08 Sep 2006
Posts: 182

View user's profile Send private message Send e-mail

PostPosted: Thu Mar 25, 2010 9:19 am     Reply with quote

Thanks!!!

I will check it when I get back to the office.....

I will keep you informed...

Regards,
Jody
Jody



Joined: 08 Sep 2006
Posts: 182

View user's profile Send private message Send e-mail

PostPosted: Fri Mar 26, 2010 2:50 am     Reply with quote

It works thanks!!!!!!!
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