epalite
Joined: 06 Apr 2008 Posts: 16
|
setup_adc_ports generates incorrect assembly codes |
Posted: Tue Apr 20, 2010 3:15 am |
|
|
Hi,
setup_adc_ports generates following incorrect assemblies, on target 16F1827.
Compiler version "CCS PCM C Compiler, Version 4.104, 51616"
1. There are no registers at BANK 3 0x10 aka 0x190.
Code: |
0DB 1010 BCF 0x10, 0
0DC 1090 BCF 0x10, 0x1
0DD 1110 BCF 0x10, 0x2
|
2. ADPREF<1:0> is incorrectly selected. 0x1e should have both bit 0 and 1 set.
Code: |
0DF 101E BCF 0x1e, 0
0E0 149E BSF 0x1e, 0x1
|
However, revising 16F1827.h on following lines helps to fix the ADPREF error.
Code: |
#define VSS_1V024 0x1300 //| Range 0-1.024V
#define VSS_2V048 0x2300 //| Range 0-2.048V
#define VSS_4V096 0x3300 //| Range 0-4.096V
|
Full disassembly:
Code: |
174: setup_adc_ports(sAN11 | VSS_1V024);
0D5 3041 MOVLW 0x41
0D6 0021 MOVLB 0x1
0D7 009D MOVWF 0x1d
0D8 3010 MOVLW 0x10
0D9 0023 MOVLB 0x3
0DA 008D MOVWF 0xd
0DB 1010 BCF 0x10, 0
0DC 1090 BCF 0x10, 0x1
0DD 1110 BCF 0x10, 0x2
0DE 0021 MOVLB 0x1
0DF 101E BCF 0x1e, 0
0E0 149E BSF 0x1e, 0x1
0E1 3000 MOVLW 0
0E2 0023 MOVLB 0x3
0E3 008C MOVWF 0xc
|
Please confirm/regress and appreciates early fix on confirmation. Thanks! |
|