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.
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?
They are static sensitive. Even if you don't feel the zap yourself, so keep yourself and the work area grounded just to be safe.
Even so, you probably haven't ruined the chip unless you applied power backwards or too high of a voltage. (above 6V)
What are you using to program it with? You may just have the wrong CONFIG word (Also called fuses) set in the programmer. Choose XT for the oscillator type.
[When the PIC is running, i took out the crystal oss.Will it spoil the PIC]
I think (I don't use MicroBasic) that the instruction
PORTB = word(AnalogInput >> 2)
Will put the 2 MSBs into RB7 and RB6
I don't know why the comments say otherwise.