Bonjour,
j'ai écris un programme en microbasic qui consiste à afficher une valeur de tension analogique (entrée A2 du PIC) mais mon afficheur ne l'affiche pas
voici mon programme:
program ADC_on_LEDs
dim temp as byte
temp1 as byte
adc_rd as word
' Lcd module connections
dim LCD_RS as sbit at RB4_bit
LCD_EN as sbit at RB5_bit
LCD_D4 as sbit at RB0_bit
LCD_D5 as sbit at RB1_bit
LCD_D6 as sbit at RB2_bit
LCD_D7 as sbit at RB3_bit
LCD_RS_Direction as sbit at TRISB4_bit
LCD_EN_Direction as sbit at TRISB5_bit
LCD_D4_Direction as sbit at TRISB0_bit
LCD_D5_Direction as sbit at TRISB1_bit
LCD_D6_Direction as sbit at TRISB2_bit
LCD_D7_Direction as sbit at TRISB3_bit
' End Lcd module connections
dim txt1 as char[16]
main:
ADCON1 = ADCON1 or 0x0C ' Set AN2 channel pin as analog
TRISA2_bit = 1 ' input
TRISB = 0x00 ' Set PORTB as output
TRISC = 0x00 ' Set PORTC as output
TRISB = 0
PORTB = 0xFF
TRISB = 0xFF
ANSEL = 0 ' Configure AN pins as digital I/O
ANSELH = 0
txt1 = "Temp:"
Lcd_Init() ' Initialize Lcd
Lcd_Cmd(_LCD_CLEAR) ' Clear display
Lcd_Cmd(_LCD_CURSOR_OFF) ' Cursor off
temp= ADC_Read(2) ' get ADC value from 2nd channel
temp1=temp*5000/1024
Lcd_Out(1,1,txt1) ' Write text in first row
Lcd_Out(2,1,temp1) ' Write temp in second row
Lcd_Chr(2,13,223) ' Print degree character, "C" for Centigrades
' different Lcd displays have different char code for degree
Lcd_Chr(2,14,"C") ' if you see greek alpha letter try typing 178 instead of 223
end.
si vous pouvez m'indiquer mon erreur ca sera très sympa de votre part
-----