Hello everyone ,
i'll say it out loud....from the start that i am relatively new to working with microcontrollers, so here's my project and here's my problem:
1st. My project :
i intended to build a serial voltmeter to check the voltage on a battery that is charged by solar energy . the initial project was intended with a pic16c711 so i bought this microcontroller and wanted to use the code that was given to program it. since i wasn't verry careful one of the pins broke and i can't use it anymore(in my area to get a pic16c711 the waitingtime is about 1 week)
so i decided to use a pic16f84a since the pins are similar.
2nd my problem
so i want to program a pic16f84a to have the RA0pin as input and the RB0 pin as digital output
so here id the code in mikrobasic that i have gotten so far , please help me add that else is needed and correct what's wrong.
main:
ANSEL = 0x17 ' Configure AN0 pin as analog
TRISA = 0xFF ' PORTA is input
ANSELH = 0 ' Configure other AN pins as digital I/O
TRISB = 0 ' PORTB is output
while (TRUE)
adc_rd = ADC_Read(0) ' get ADC value from 2nd channel
PORTB = adc_rd ' display adc_rd[7..0]
wend
end.
i'll say it out loud....from the start that i am relatively new to working with microcontrollers, so here's my project and here's my problem:
1st. My project :
i intended to build a serial voltmeter to check the voltage on a battery that is charged by solar energy . the initial project was intended with a pic16c711 so i bought this microcontroller and wanted to use the code that was given to program it. since i wasn't verry careful one of the pins broke and i can't use it anymore(in my area to get a pic16c711 the waitingtime is about 1 week)
so i decided to use a pic16f84a since the pins are similar.
2nd my problem
so i want to program a pic16f84a to have the RA0pin as input and the RB0 pin as digital output
so here id the code in mikrobasic that i have gotten so far , please help me add that else is needed and correct what's wrong.
main:
ANSEL = 0x17 ' Configure AN0 pin as analog
TRISA = 0xFF ' PORTA is input
ANSELH = 0 ' Configure other AN pins as digital I/O
TRISB = 0 ' PORTB is output
while (TRUE)
adc_rd = ADC_Read(0) ' get ADC value from 2nd channel
PORTB = adc_rd ' display adc_rd[7..0]
wend
end.