Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC 16F 877 program , Request help from NEWBIE

Status
Not open for further replies.

Flying

New Member
circuit.JPG

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.
 
ya, one more question.. May i use voltage divider rule (connection of 2 series resistors) to supply 2.2V from 5V?
 
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]
Won't hurt it. It will just stop running until you put the crystal back.

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]?
I don't use MikroBasic, but it looks like it does according to the comments in the code that you downloaded.
 
Flying said:
ya, one more question.. May i use voltage divider rule (connection of 2 series resistors) to supply 2.2V from 5V?

You don't need to supply 2.2V - this is the output from the internal voltage reference.

Mike.
 
Flying said:
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]?
[/B]

[MSB] RB7,RB6,RD7,RD6,RD5,RD4,RD3,RD2,RD1,RD0 [LSB]

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.

Mike.
 
Hi,
Did u simulate ur code? if simulation is succesful then the pic will give results correctly.

I just spoil two PIC16F877A. Even simple LED blinking program also couldn't work. Does PIC very sensitive? What causes make it spoil?

I dont think it is spoiled, how d u say it is spoiled, is ur pic not accepting the program while re-programming or the pic only not blinking the LED?

I think ur problem is in ur code? i dont know mikroBasic but try this link for ur doubt

https://www.melabs.com/products/labx1.htm
and download
LAB-X1 docs and PICBASIC™example programs(76K ZIP file)
It has lot of example programs
 
You need to connect both VDD and both VSS pins of the pic to the power supply, this is not shown on your scematic.
 
also
1.make sure you add 0.1 uF capacitor as close as you can of your PIC
2.make sure the LVP mode is disabled in your config fuse.
 
Exo said:
You need to connect both VDD and both VSS pins of the pic to the power supply, this is not shown on your scematic.

i did connect the both of VDD and VSS to power supply.
 
Pommie said:
You don't need to supply 2.2V - this is the output from the internal voltage reference.

Mike.

Wat r the meaning of internal voltage refrence? Is it writing the code in PIC to give 2.2 V reference?
 
I will try to reprogram the PIC and burn the program again. But most properly not now, bec i will facing final exam as soon. Thx for help .. ^_^
 
Mike.:
You don't need to supply 2.2V - this is the output from the internal voltage reference.

what is it meaning ??Wat r the meaning of internal voltage refrence? Is it writing the code in PIC to give 2.2 V reference?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top