Hi, All. I m new. Hope u can help me.
I compile this program as shown below. Does this program working? It compile in MikroBasic successfully. I just spoil two PIC16F877A. Even simple LED blinking program also couldn't work. Does PIC very sensitive? What causes make it spoil? [When the PIC is running, i took out the crystal oss.Will it spoil the PIC]
What is the MSB and LSB output? does the sequence of value in this way, [MSB] RD7,RD6,RD5,RD4,RD3,RD2,RD1,RD0,RB7,RB6 [LSB]?
MikroBasic Program:
program MyProject
dim AnalogInput as word
main:
ADCON1 = $8F ' configure analog inputs and Vref
ADCON0 = $45
TRISA = $0D ' designate RA0,RA2,RA3 pins as input
TRISD = $0 ' designate PORTD as output
TRISB = $0 ' designate PORTB (RB7, RB6 pins) as outputs
while true
AnalogInput = ADC_read(0)
'now use analogInput... To read from RA0
PORTD = AnalogInput ' send upper 8 bits to PORTB
PORTB = word(AnalogInput >> 2)
' send two least significant bits to PORTB, pins RB7,RB6
wend
end.