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.

Program 16F877A using PicBasic Pro

Status
Not open for further replies.

sll

New Member
Hi all,

I'm a mechanical engineering student, but I need to build a small and simple controler for my project. I'm been asking around, and I finally ended up with the 16F877A. (It's a long story, but I don't want to waste you time).

So

- Chip 16F877A
- PicBasic Pro

To get started, I just one to write a program for this chip that blink a LED using Picbasic Pro.

This is what I wrote (with the help from friend)
---------------------------------------------

'blinking led
define ocs 20
CMCON=7
ADCON1=14
TRISB=%00000000
'declare vars
led_1 Var PORTB.7
'o
main:
HIGH led_1
PAUSE 1000
LOW led_1
PAUSE 1000
GOTO main

--------------------------------------------

I don't know why it's not working.

Please help me.

Thanks a million.
 
1)Check the fuses. WDT should be off.
2)Check for the crystal setting. choose HS if you are using crystals above 4 MHz.
3)Check the hardware. Check the LED connections.
4)Post your schematic
 
I use MicroCode Studio - Pic Basic Pro; not sure the version.
My programer is a DIY - K150.

I've been using these to work with 16F88 for a year. It works fine.
----------------------------
WDT is off
Oscillator is HS
----------------------------

However, before programing, this is what I notice

ROM = Not erased
EEPROM = Erased
ID = Erased
Fuse = Not Erased

is that normal ?

In the circuit, I setup two more leds at two different ports to try instead of PortB.7; nothing lights up :(
 

Attachments

  • IMG_0870.JPG
    IMG_0870.JPG
    43.4 KB · Views: 455
Before, I didn't need any crystal for my 16F88; I just needed these two lines

define ocs 8
osccon.4=1 : osccon.5=1 : osccon.6=1

I thought this would do for the 16F877A.

Ok, I'll put the crystal in, and report the problem.

Thanks for your help.
 
sll said:
Before, I didn't need any crystal for my 16F88; I just needed these two lines

define ocs 8
osccon.4=1 : osccon.5=1 : osccon.6=1

I thought this would do for the 16F877A.

Ok, I'll put the crystal in, and report the problem.

Thanks for your help.

You'll be happy to know the 16F887 has the built in oscillator and is a modern version of the 16F877A
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top