PDA

View Full Version : 16f877a help



oreo
- 14th June 2008, 19:50
Hello,
Am new to programming and cant get my 16f877a to do anything. Any help out there?

skimask
- 14th June 2008, 20:21
Hello,
Am new to programming and cant get my 16f877a to do anything. Any help out there?

Not without knowing if you're trying to get your 877a to taste like cookies in the oven, fetch a stick, or if you're actually trying to program it....The '877 that is...not the stick.

http://www.picbasic.co.uk/forum/showthread.php?t=1742

skimask
- 17th June 2008, 02:38
Re-Read Post #2 instead of PM'ing me...
You'll get a lot more help that way.

oreo
- 17th June 2008, 12:53
Ok here is the simple code I am trying to run. It compiles but the output doesnt come on

#include <pic.h>

__config (PCMDIS & IESODIS & BORDIS & UNPROTECT & MCLRDIS & PWRTEN & WDTDIS & INTIO); //I don’t know what is supposed to go in this, which is the main problem.



main(){

PORTA = 0;

//CMCON0 = 7; //would not compile with these two statements in

//ANSEL = 0;

TRISA4 = 0;

TRISA5 = 0;

while(1==1){

RA4 = 1;

}

}
Do I need the config statement or not?

skimask
- 17th June 2008, 13:59
Let's see...
I don't think the bulk of the above code will compile using MeLabs PICBASIC PRO, like the writing at the top of the page specifies these forums are generally for.
I could be wrong...
Please tell me if I'm wrong...
I don't like to be wrong...
I don't mind being wrong...
But I still don't like it...

I guess you were fetching a stick from the oven...

oreo
- 17th June 2008, 14:15
at least im not a jerk!!

sonicm
- 17th June 2008, 14:20
at least im not a jerk!!

you can read picbasic manual and check your syntax is correct? one by one

like
-main() in picbasic don't have
-TRISA4 should be TRISA.4


try to read picbasic manaual you should start from there.

skimask
- 17th June 2008, 14:23
at least im not a jerk!!
Maybe...maybe not...
But my eyes work fine. Have you checked the focus on your monitor lately? Maybe that's why you didn't see the numerous references to PicBasicPro. It could happen...

And sonicm is 100% right. Every one of those commands/statements/lines is easily converted to something usable with the PicBasicPro compiler...assuming one has the correct reference material and/or knowledge.

Bruce
- 17th June 2008, 14:50
A wild guess on my part, but looking at your config statement, I'm guessing that you're
using the Hi-Tech PIC C compiler?

Hi-Tech has a web forum. I'm sure if you signup there someone will be happy to help you get
going, but you definitely will want to review the 877A data sheet.

You'll need to disable A/D to use some pins as digital I/O, and RA4 is an open-drain type
output.

RussMartin
- 17th June 2008, 18:36
Oreo, it's not clear to us what you are using for a compiler, and for programming, and what physical platform you have for your '877A.

Is your platform just an 877A and a solderless breadboard, or do you have a kit or development board of some sort?

If you're using PIC BASIC or PIC BASIC PRO and haven't already done so, you might consider getting something like the MELabs X-1 board. It's available assembled or as a kit. One nice thing about packages like this is that they often come with several simple routines already tested, working, and you can use them as starting points to learn to do more.

The nice thing about starting with simple, known-good programs is that you can start tinkering with them. As soon as something doesn't work, you can stop and look at your code and learn from what didn't work because you know that the core from which you started did work.

oreo
- 18th June 2008, 02:10
I appreciate all of the positive comments or suggestions. But as skimask pointed out I started at the wrong forum and completely wasted his/your valuable time. I want to thank Bruce and Russmartin and sonicm , they seemed to want to help.
I will try and find the correct forum and not waste your time any more. This will be my last post here.

skimask
- 18th June 2008, 04:04
I will try and find the correct forum and not waste your time any more. This will be my last post here.
Didn't waste any of my time...
Looks like you wasted your time...
Might not have wasted any time had a book or two been read a bit beforehand...
But that's just me...
I could be wrong...again

Archangel
- 18th June 2008, 05:50
I appreciate all of the positive comments or suggestions. But as skimask pointed out I started at the wrong forum and completely wasted his/your valuable time. I want to thank Bruce and Russmartin and sonicm , they seemed to want to help.
I will try and find the correct forum and not waste your time any more. This will be my last post here.Or you could download the evaluation version from M E Labs and jump right in and get your feet wet and be a <b>valued contributor here . . .