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

Programming 12f629 - some tips

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



Joined: 23 Dec 2003
Posts: 3

View user's profile Send private message

Programming 12f629 - some tips
PostPosted: Tue Dec 23, 2003 5:31 am     Reply with quote

I have been programming this device for a few days now and can offer these observations which may help.

The 12F629 does not have an A/D converter but you still need to set the Analog Select (ANSEL)register and the Comparator Control (CMCON) register to get the digital i/o working. i.e.

#byte CMCON=0x19
#byte ANSEL=0x9f

main() {

CMCON=0x07; // Comparator off.
ANSEL=0x00; // All i/o digital.

// Normal i/o commands i.e. output_low will now work Smile

}


The #fuses INTRC and INTRC_IO compile to produce a call to 3FFh in order to load the clock calibration value. If the pre-loaded RETLW XX instruction has been erased by erasing the whole device (very easy to do with the PromateII, but not as easy to recover Crying or Very sad ) then the program will hang. This would explain some of the problems reported.

The PICkit 1 Flash starter kit works well with MPLAB and has the very useful facility of being able to re-calculate and re-load the calibration value at 3ffh.

Hope this helps, and I hope this post does not disappear into the ether as my last one did Exclamation
burnsy



Joined: 18 Oct 2003
Posts: 35
Location: Brisbane, Australia

View user's profile Send private message Send e-mail Visit poster's website

Thanks
PostPosted: Fri Dec 26, 2003 5:05 pm     Reply with quote

Thanks, that worked well for me too. Very Happy
_________________
This is the last code change until its ready....
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