Simple output not working

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
ukweb
Posts: 16
Joined: Fri Jul 28, 2006 8:35 pm
Contact:

Simple output not working

Post by ukweb »

Using matrix multimedai board v2
PIC 16f876

Following program

Code: Select all

#include <system.h>

main()
{
set_bit(STATUS, RP0); //SELECTS BANK 1
TRISB=0x00;  //MAKES PORTB OUTPUT
TRISA=0xff;  //MAKES PORTA INPUT
clear_bit(STATUS, RP0);  //SELECTS BANK 0
if(input_pin_port_a(0))
{
PORTB=0xff;
}
else
PORTB=0x00;
}


Compiles and assembles (hex file). burns to the chip... but does not show the expected out put at all.

What settings are to be used like RC or XT on the board.
FAST or SLOW settings, to make the program work.

Ian
Posts: 110
Joined: Thu Sep 29, 2005 10:53 am
Location: Matrix Multimedia
Been thanked: 1 time
Contact:

Post by Ian »

Did you turn the Analogue pins off?
A0 is analogue by default unless turned off.

Add the following to the program:

//PIC Initialisation
adcon1 = 0x07;

Post Reply