kisa72
Newbie level 4
- Joined
- Jun 26, 2013
- Messages
- 6
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 59
Hi,
I'm hoping this is something simple, I've been at it most evenings this week and I'm slowly going insane.
I just got back into pic programming (well trying to) after a few years and I'm failing epicly.
I'm using a PICkit 2 and a dev boeard I made a while ago that holds a 16f877a and is programmed via an ICD connector.
This is the code I'm compiling and programming onto the pic:-
The code compiles fine and programs/varifying fine on the PIC and it even runs properly on the PIC Simulator IDE, but when I actually run it on the PIC nothing happens i.e. the LED connected to RB.1 does not get lit (The LED it's held high and should light when RB.1 is pulled low).
I've tried a variety of different code examples, compiled using XC8 and Hi-Tech as well as trying PBP. Nothing seems to work.
So of course I though it might be my test board, but I downloaded and already complied .hex for the 16f877a and programmed it in and it worked fine, all Port B was happily flashing away.
With the code above programmed in, I measured the following voltages across Port B:-
RB.0 - 5V
RB.1 - 3.4V
RB.2 - 3.4V
RB.3 - RB.7 - 0V
Any help would be great.
Thank you.
I'm hoping this is something simple, I've been at it most evenings this week and I'm slowly going insane.
I just got back into pic programming (well trying to) after a few years and I'm failing epicly.
I'm using a PICkit 2 and a dev boeard I made a while ago that holds a 16f877a and is programmed via an ICD connector.
This is the code I'm compiling and programming onto the pic:-
Code:
//(c)Shane Tolmie, http://www.microchipc.com/, distribute freely for non commercial use on the condition that you include this web link somewhere in your document.
#include <pic.h> //designed for PIC16F877
#include <htc.h>
#define _XTAL_FREQ 20000000L // Used in __delay_ms() functions
#define OUTPUT 0
#define INPUT 1
main()
{
while(1)
{
TRISB1=OUTPUT; //change port RB1 direction to output
RB1=1; //produce 5V on RB1, pin 2 of micro
__delay_ms(500); // delay 500ms
RB1=0; //produce 0V on RB1, pin 2 of micro
__delay_ms(500); // delay 500ms
}
}
The code compiles fine and programs/varifying fine on the PIC and it even runs properly on the PIC Simulator IDE, but when I actually run it on the PIC nothing happens i.e. the LED connected to RB.1 does not get lit (The LED it's held high and should light when RB.1 is pulled low).
I've tried a variety of different code examples, compiled using XC8 and Hi-Tech as well as trying PBP. Nothing seems to work.
So of course I though it might be my test board, but I downloaded and already complied .hex for the 16f877a and programmed it in and it worked fine, all Port B was happily flashing away.
With the code above programmed in, I measured the following voltages across Port B:-
RB.0 - 5V
RB.1 - 3.4V
RB.2 - 3.4V
RB.3 - RB.7 - 0V
Any help would be great.
Thank you.