![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Diego Guzman Guest
|
12c508a problem |
Posted: Wed Apr 23, 2003 9:39 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: 12c508a problem |
Posted: Wed Apr 23, 2003 11:45 am |
|
|
:=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 |
|
![](templates/subSilver/images/spacer.gif) |
Diego Guzman Guest
|
Re: 12c508a problem |
Posted: Thu Apr 24, 2003 9:30 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
R.J.Hamlett Guest
|
Re: 12c508a problem |
Posted: Thu Apr 24, 2003 10:50 am |
|
|
:=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 |
|
![](templates/subSilver/images/spacer.gif) |
Diego Guzman Guest
|
Re: 12c508a problem |
Posted: Sat Apr 26, 2003 10:22 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Felix Althaus
Joined: 09 Sep 2003 Posts: 67 Location: Winterthur, Switzerland
|
Re: 12c508a problem |
Posted: Sat Apr 26, 2003 12:50 pm |
|
|
:=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 |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|