|
|
View previous topic :: View next topic |
Author |
Message |
cube007 Guest
|
Using ICSPCLK and ICSPDAT as input? |
Posted: Sun Aug 24, 2003 4:52 am |
|
|
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? |
Posted: Sun Aug 24, 2003 8:12 am |
|
|
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
|
Re: Using ICSPCLK and ICSPDAT as input? |
Posted: Sun Aug 24, 2003 2:12 pm |
|
|
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? |
Posted: Sun Aug 24, 2003 3:19 pm |
|
|
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 |
|
|
|
|
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
|