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

Using ICSPCLK and ICSPDAT as input?

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







Using ICSPCLK and ICSPDAT as input?
PostPosted: Sun Aug 24, 2003 4:52 am     Reply with quote

Hello,

I'm using a PIC16F676. When trying to use the ICSPCLK and ICSPDAT as a normal input, it's not possible to read out these pins.

That is my code:

#include <16F676.h>
#device adc=8
#use delay(clock=4000000)
#fuses INTRC_IO,BANDGAPHIGH,NOPROTECT,BROWNOUT,NOMCLR,NOCPD,NOWDT,PUT
#rom 0x3ff = {0x3470}

#include "main.h"
void main() {
setup_adc(ADC_OFF);

setup_timer_1 (T1_DISABLED);

setup_comparator(FALSE);
setup_vref(FALSE);

while(1) {
output_high(PIN_C3);
delay_ms(200);
output_low(PIN_C3);
delay_ms(200);

if (input(PIN_A0))
output_high(PIN_C4);
else
output_low(PIN_C4);
}
}


Is there anything I did't noticed in the spec?

Best regrads,
cube007
___________________________
This message was ported from CCS's old forum
Original Post ID: 144517187
cube007
Guest







Re: Using ICSPCLK and ICSPDAT as input?
PostPosted: Sun Aug 24, 2003 8:12 am     Reply with quote

Ok, now I got it.

It is necessary to init the adc ports with "setup_adc_ports(xxx)" and to disable the comparator with "setup_comparator(NC_NC)".

By,
cube007
___________________________
This message was ported from CCS's old forum
Original Post ID: 144517189
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

Re: Using ICSPCLK and ICSPDAT as input?
PostPosted: Sun Aug 24, 2003 2:12 pm     Reply with quote

I prefer to set everything up manually by reading the datasheets for the PIC. However, I believe that you need to do this

setup_adc_ports(NO_ANALOGS);

Mark

:=Hello,
:=
:=I'm using a PIC16F676. When trying to use the ICSPCLK and ICSPDAT as a normal input, it's not possible to read out these pins.
:=
:=That is my code:
:=
:=#include <16F676.h>
:=#device adc=8
:=#use delay(clock=4000000)
:=#fuses INTRC_IO,BANDGAPHIGH,NOPROTECT,BROWNOUT,NOMCLR,NOCPD,NOWDT,PUT
:=#rom 0x3ff = {0x3470}
:=
:=#include "main.h"
:=void main() {
:= setup_adc(ADC_OFF);
:=
:= setup_timer_1 (T1_DISABLED);
:=
:= setup_comparator(FALSE);
:= setup_vref(FALSE);
:=
:= while(1) {
:= output_high(PIN_C3);
:= delay_ms(200);
:= output_low(PIN_C3);
:= delay_ms(200);
:=
:= if (input(PIN_A0))
:= output_high(PIN_C4);
:= else
:= output_low(PIN_C4);
:= }
:=}
:=
:=
:=Is there anything I did't noticed in the spec?
:=
:=Best regrads,
:=cube007
___________________________
This message was ported from CCS's old forum
Original Post ID: 144517196
cube007
Guest







Re: Using ICSPCLK and ICSPDAT as input?
PostPosted: Sun Aug 24, 2003 3:19 pm     Reply with quote

Hello Mark,

actually I got the solution (please take a look at this post: <a href="http://www.pic-c.com/forum/general/posts/144517189.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/144517189.html</a>). First I tried "setup_adc_ports(NO_ANALOGS)" but this command is not supported with the CCS and the PIC16F676.

cube007

:=I prefer to set everything up manually by reading the datasheets for the PIC. However, I believe that you need to do this
:=
:=setup_adc_ports(NO_ANALOGS);
:=
:=Mark
:=
:=:=Hello,
:=:=
:=:=I'm using a PIC16F676. When trying to use the ICSPCLK and ICSPDAT as a normal input, it's not possible to read out these pins.
:=:=
:=:=That is my code:
:=:=
:=:=#include <16F676.h>
:=:=#device adc=8
:=:=#use delay(clock=4000000)
:=:=#fuses INTRC_IO,BANDGAPHIGH,NOPROTECT,BROWNOUT,NOMCLR,NOCPD,NOWDT,PUT
:=:=#rom 0x3ff = {0x3470}
:=:=
:=:=#include "main.h"
:=:=void main() {
:=:= setup_adc(ADC_OFF);
:=:=
:=:= setup_timer_1 (T1_DISABLED);
:=:=
:=:= setup_comparator(FALSE);
:=:= setup_vref(FALSE);
:=:=
:=:= while(1) {
:=:= output_high(PIN_C3);
:=:= delay_ms(200);
:=:= output_low(PIN_C3);
:=:= delay_ms(200);
:=:=
:=:= if (input(PIN_A0))
:=:= output_high(PIN_C4);
:=:= else
:=:= output_low(PIN_C4);
:=:= }
:=:=}
:=:=
:=:=
:=:=Is there anything I did't noticed in the spec?
:=:=
:=:=Best regrads,
:=:=cube007
___________________________
This message was ported from CCS's old forum
Original Post ID: 144517199
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