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

12c508a problem

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







12c508a problem
PostPosted: Wed Apr 23, 2003 9:39 am     Reply with quote

Hi, im working for first time with pic12c508a, and i have a problem setting the internal clock, it doesnt work, i put the direcitives of __config _IntRC_OSC and then put 0xff in the oscal register to have the highest frequency, and doesnt work.

I need to generate a square singal of 700khz, so i need help to setup the internal clock at 4Mhz.

I read that the directive #rom 0x000 = {0x0025} works, thats ok??

Thanks

Diego
___________________________
This message was ported from CCS's old forum
Original Post ID: 13944
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: 12c508a problem
PostPosted: Wed Apr 23, 2003 11:45 am     Reply with quote

:=Hi, im working for first time with pic12c508a, and i have a problem setting the internal clock, it doesnt work, i put the direcitives of __config _IntRC_OSC and then put 0xff in the oscal register to have the highest frequency, and doesnt work.
--------------------------------------------------

CCS does not use the __config directive. CCS uses the #fuses
directive. This is in the manual.

See this example program, which shows how to use the #fuses
statement:
<a href="http://www.cc.puv.fi/~t0101190/projekti/source/Examples/ex_8pin.c" TARGET="_blank">http://www.cc.puv.fi/~t0101190/projekti/source/Examples/ex_8pin.c</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 13947
Diego Guzman
Guest







Re: 12c508a problem
PostPosted: Thu Apr 24, 2003 9:30 am     Reply with quote

I'm confused because i´m working with both assembler and ccs, because both of them doesnt work. In the ccs using the #fuse directive, and define the I/O lines, using the next code:

#include <12C508A.h>

#fuses NOWDT, NOPROTECT, INTRC, MCLR


#use fast_io(B)

#byte portb = 0x06
#bit rec = 0x06.4
#bit tri = 0x06.0
#bit emi = 0x06.2


#use delay(clock = 4000000)

#rom 0x000 = {0x0025} ; this directive i use because i read
with this the internal rc works but
it doesnt


inicializar (){
portb = 0x00;
set_tris_b(0b00011000);

}

void main() {
inicializar();
portb = 0x00;
while (TRUE){
if(rec==0){
tri = 0;
emi = 1;
delay_ms(0.7);
emi = 0;
delay_ms(0.7);
}
else tri = 1;
}
}

i dont know what is wrong here, could you help me..
___________________________
This message was ported from CCS's old forum
Original Post ID: 13974
R.J.Hamlett
Guest







Re: 12c508a problem
PostPosted: Thu Apr 24, 2003 10:50 am     Reply with quote

:=I'm confused because i´m working with both assembler and ccs, because both of them doesnt work. In the ccs using the #fuse directive, and define the I/O lines, using the next code:
:=
:=#include <12C508A.h>
:=
:=#fuses NOWDT, NOPROTECT, INTRC, MCLR
With MCLR selected, you must ensure that pin 4 has a pull-up. Is this true?.

:=
:=#use fast_io(B)
:=
:=#byte portb = 0x06
:=#bit rec = 0x06.4
:=#bit tri = 0x06.0
:=#bit emi = 0x06.2
:=
:=
:=#use delay(clock = 4000000)
:=
:=#rom 0x000 = {0x0025} ; this directive i use because i read
:= with this the internal rc works but
:= it doesnt
:=
You do not need this. If you select the RC oscillator, the compiler automatically inserts a MOVWF 05 instruction at the start of memory.

:=inicializar (){
:= portb = 0x00;
:= set_tris_b(0b00011000);
:=
:= }
:=
:=void main() {
:= inicializar();
:= portb = 0x00;
:= while (TRUE){
:= if(rec==0){
:= tri = 0;
:= emi = 1;
:= delay_ms(0.7);
You cannot have floating point delays. If you want a 0.7mSec delay, use delay_us(700);

:= emi = 0;
:= delay_ms(0.7);
:= }
:= else tri = 1;
:= }
:=}
:=
:=i dont know what is wrong here, could you help me..
I suspect the main fault, is the use of a floating point value on the delay.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 13977
Diego Guzman
Guest







Re: 12c508a problem
PostPosted: Sat Apr 26, 2003 10:22 am     Reply with quote

Thank you R.J.Hamlett, i'm gone a try your tips, i only need to buy more 12c508a
___________________________
This message was ported from CCS's old forum
Original Post ID: 14011
Felix Althaus



Joined: 09 Sep 2003
Posts: 67
Location: Winterthur, Switzerland

View user's profile Send private message

Re: 12c508a problem
PostPosted: Sat Apr 26, 2003 12:50 pm     Reply with quote

:=Thank you R.J.Hamlett, i'm gone a try your tips, i only need to buy more 12c508a

What about using a -JW part with eprom and window to erase this with UV light (if they exist for 12c508)?
So you only need one part for experimenting (ok, it will cost more)

mfg
Felix
___________________________
This message was ported from CCS's old forum
Original Post ID: 14013
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