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

Problem with PIC12F683

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







Problem with PIC12F683
PostPosted: Mon Nov 07, 2005 5:51 pm     Reply with quote

I'm having problem using PCWH Version 3.206 with PIC12F683. I'm doing a simple program to test the pic, but they are not working. Can anyone please tell me what is wrong with this code?

#include <12F683.h>
#device ADC=10//to define size of AD Channel
#fuses INTRC_IO, NOWDT,NOPROTECT,NOCPD,NOBROWNOUT,NOMCLR,NOPUT,NOIESO,NOFCMEN
#use delay(clock=4000000)

//Setup Software serial communicationl
#use rs232(baud=9600, xmit=PIN_A5,BITS=8,INVERT)

void main(){
while(1)
{
output_high(PIN_A2);
DELAY_MS(500);
output_low(PIN_A2);
DELAY_MS(500);
}
}

I'm sure that it's not the hardware problem. There is no output at Pin a2 at all. Please tell me how to fix this.

Thank you


}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Nov 07, 2005 7:00 pm     Reply with quote

Quote:

I'm having problem using PCWH Version 3.206 with PIC12F683.
I'm doing a simple program to test the pic, but they are not working

Your version of the compiler doesn't setup the i/o ports for digital i/o
correctly. To fix the problem, you need to add the lines shown in
bold below, to your program.
Quote:
#include <12F683.h>
#device ADC=10//to define size of AD Channel
#fuses INTRC_IO, NOWDT,NOPROTECT,NOCPD,NOBROWNOUT,NOMCLR,NOPUT,NOIESO,NOFCMEN
#use delay(clock=4000000)

//Setup Software serial communicationl
#use rs232(baud=9600, xmit=PIN_A5,BITS=8,INVERT)


// Define register addresses so we can write to them directly.
#byte CMCON0 = 0x19
#byte ADCON0 = 0x1F
#byte ANSEL = 0x9F


void main()
{
CMCON0 = 7; // Turn off the comparators
ADCON0 = 0; // Set all i/o pins to digital
ANSEL = 0; // Turn off the A/D converter


while(1)
{
output_high(PIN_A2);
DELAY_MS(500);
output_low(PIN_A2);
DELAY_MS(500);
}
}
obi
Guest







PostPosted: Tue Nov 08, 2005 10:17 am     Reply with quote

Thank you for your help. It's working!!!
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