![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
G'day all.
I'm having some trouble getting an f88's internal AD to work. I have gone over the data sheet and come up with the following code which dosn't work! But i don't know what i'm missing or doing wrong. BCF STATUS, RP1 BCF STATUS, RP0 ; ; MOVLW B'00000001' BSF STATUS, RP0 IORWF TRISA, F ;make bit 0 on port A input MOVLW B'10000001' MOVWF ADCON0 ; set Fosc/32, chanel 0 , AD on MOVLW B'11000000' MOVWF ADCON1 ; set right justified, /2 fosc, internal reference MOVLW 1 MOVWF ANSEL ; set chanel 0 BCF PIE1, ADIE ; clear interupts MOVLW 6;* MOVWF AUX;* NOP;* PAGESEL (LAB_DLY_21);* LAB_DLY_21;* DECFSZ AUX;* GOTO LAB_DLY_21;* ; 20 uS delay BSF ADCON0, GO ;start conversion ADCLAB1 BCF STATUS, RP1 BSF STATUS, RP0 PAGESEL (ADCLAB1) BTFSC ADCON0, GO GOTO ADCLAB1 ;wait till conversion is finished MOVF ADRESL, W ;store result in var pulsetime2 BCF STATUS, RP0 MOVWF PULSETIME2_L BSF STATUS, RP0 MOVF ADRESH, W BCF STATUS, RP0 MOVWF PULSETIME2_H I had written the entire application on a 16f877 on which the above AD code worked fine. But since porting back to the f88 i can't get it to work, the returned value in pulsetime2 is always 0.. Can anyone help? Cheers Leeroy |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| 16F88 vs. 16LF88? | Hank Fletcher | Micro Controllers | 23 | 30th June 2007 11:27 AM |
| programming a 16f88 using JAL | noh.way.jose | Micro Controllers | 4 | 29th April 2007 04:01 AM |
| 16F88 Code protected question | RonnyBone | Micro Controllers | 6 | 30th October 2006 08:30 AM |
| 6V to 16F88 to much? | brodin | Micro Controllers | 3 | 12th March 2004 04:07 PM |
| 16F88 internal oscillator problems | Jimbob's Ma | Micro Controllers | 1 | 1st March 2004 09:27 PM |