View previous topic :: View next topic |
Author |
Message |
esbelektronik
Joined: 13 Dec 2018 Posts: 23
|
PIC16F19197 PORTF can not read input |
Posted: Sat Jan 12, 2019 3:55 pm |
|
|
Hi,
I try read pin_f4 pin but not read. You see my c code and compare to assembly code. I want read pin_f4 but reading pin_a4.
Code: |
.................... if (input(PIN_f4)==1)
0B1D: MOVLB 05
0B1E: BTFSS 0C.4 (pin_a4 address!!)
0B1F: GOTO 32A
.................... {output_high(pintimeronoffled);
0B20: MOVLW C3
0B21: MOVLB 00
0B22: MOVWF 14
0B23: BSF 1A.3
|
Thanks _________________ ^ ^
(q p) ESB
( V )
L L |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Sat Jan 12, 2019 5:19 pm |
|
|
You should post a small program that shows your code AND your compiler version number.
If you have a variable you name PIN_f4 that would not be the same as PIN_F4, if you've got #CASE in your code. I have been caught with 'case sensitive before...
The other possibilty is an error in the compiler. |
|
|
esbelektronik
Joined: 13 Dec 2018 Posts: 23
|
|
Posted: Sat Jan 12, 2019 5:36 pm |
|
|
temtronic wrote: | You should post a small program that shows your code AND your compiler version number.
If you have a variable you name PIN_f4 that would not be the same as PIN_F4, if you've got #CASE in your code.I have been caught with 'case sensitive before...
The other possibilty is an error in the compiler.
|
Thanks temtronic,
You see if i use portc compare asm file, portc BTFSS 0E.4 address is right. When i use portf, write wrong address:
Code: |
.................... if (input(PIN_C4)==1)
0B1D: MOVLW C3
0B1E: MOVWF 14
0B1F: BTFSS 0E.4
0B20: GOTO 329
.............................
|
it's my main procedure.
Code: |
#ZERO_RAM
void main()
{
setup_oscillator(OSC_HFINTRC_32MHZ );
setup_dac(DAC_OFF);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
setup_lcd(LCD_DISABLED);
setup_adc(ADC_CLOCK_INTERNAL | ADC_CLOCK_DIV_2 |NO_ANALOGS_P2);
setup_adc_reference(VSS_VDD);
setup_adc_ports(sAN0|sAN1|sAN2);
set_analog_pins(PIN_A0,PIN_A1,PIN_A2);
setup_zcd(ZCD_ENABLE|ZCD_INT_L_TO_H);
set_tris_f(0b00011111);
set_tris_a(0b11111111);
set_input_level_f(0xFF);
set_slow_slew_f(0b00000000);
set_open_drain_f(0b00000000);
setup_rtc(RTC_ENABLE | RTC_CLOCK_SOSC );
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(T0_INTERNAL|T0_DIV_8);
setup_timer_1(T1_INTERNAL |T1_DIV_BY_2);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
disable_interrupts(INT_TIMER2);
enable_interrupts(INT_TIMER1);
enable_interrupts(INT_TIMER0);
disable_interrupts(INT_EXT);
enable_interrupts(INT_ZCD);
} |
_________________ ^ ^
(q p) ESB
( V )
L L |
|
|
esbelektronik
Joined: 13 Dec 2018 Posts: 23
|
|
Posted: Sat Jan 12, 2019 5:38 pm |
|
|
temtronic wrote: | You should post a small program that shows your code AND your compiler version number.
If you have a variable you name PIN_f4 that would not be the same as PIN_F4, if you've got #CASE in your code.I have been caught with 'case sensitive before...
The other possibilty is an error in the compiler. |
compiler version is 5.082. _________________ ^ ^
(q p) ESB
( V )
L L |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Jan 12, 2019 9:02 pm |
|
|
It's a compiler bug. The following work-around code will read the correct
port address. With this method, you have to set the TRIS manually, but
you're already doing that in your main() program anyway.
Code: | #include <16F19197.h>
#fuses NOWDT
#use delay(internal=4M)
#byte PORTF = getenv("SFR:PORTF")
//===============================
void main(void)
{
int8 temp;
temp = bit_test(PORTF, 4);
while(TRUE);
}
|
This bug should be reported to CCS. |
|
|
esbelektronik
Joined: 13 Dec 2018 Posts: 23
|
|
Posted: Sun Jan 13, 2019 4:02 am |
|
|
PCM programmer wrote: | It's a compiler bug. The following work-around code will read the correct
port address. With this method, you have to set the TRIS manually, but
you're already doing that in your main() program anyway.
Code: | #include <16F19197.h>
#fuses NOWDT
#use delay(internal=4M)
#byte PORTF = getenv("SFR:PORTF")
//===============================
void main(void)
{
int8 temp;
temp = bit_test(PORTF, 4);
while(TRUE);
}
|
This bug should be reported to CCS.
|
Thanks PCM programmer,
it's work.
Code: |
.................... if (bit_test(PORTF, 4))
0B81: BTFSS 11.4 |
_________________ ^ ^
(q p) ESB
( V )
L L |
|
|
esbelektronik
Joined: 13 Dec 2018 Posts: 23
|
|
Posted: Sun Jan 13, 2019 4:17 am |
|
|
PCM programmer wrote: | It's a compiler bug. The following work-around code will read the correct
port address. With this method, you have to set the TRIS manually, but
you're already doing that in your main() program anyway.
Code: | #include <16F19197.h>
#fuses NOWDT
#use delay(internal=4M)
#byte PORTF = getenv("SFR:PORTF")
//===============================
void main(void)
{
int8 temp;
temp = bit_test(PORTF, 4);
while(TRUE);
}
|
This bug should be reported to CCS. |
there is similar problem within PORTH!! I solved it with the method. Thanks _________________ ^ ^
(q p) ESB
( V )
L L |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19551
|
|
Posted: Sun Jan 13, 2019 11:53 am |
|
|
Please report both to CCS.
It is very difficult for them to keep up with all the nuances of new PIC's,
so feedback from us is vital. |
|
|
esbelektronik
Joined: 13 Dec 2018 Posts: 23
|
|
Posted: Sun Jan 13, 2019 3:43 pm |
|
|
Ttelmah wrote: | Please report both to CCS.
It is very difficult for them to keep up with all the nuances of new PIC's,
so feedback from us is vital. |
Yes you are right. I reported to CCS. I think I am the first CCS user to use the PIC16F19197
Thanks _________________ ^ ^
(q p) ESB
( V )
L L |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19551
|
|
Posted: Mon Jan 14, 2019 2:37 am |
|
|
Yes.
This is why you will see a lot of the 'old hands' here staying with the last generation chips, rather than leaping to new ones. With the rate that MicroChip launches new types, it is very hard for CCS to keep up, and even harder to get everything right... |
|
|
|