HP488

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
mircea2012
Posts: 3
Joined: Thu Jan 10, 2013 3:53 pm

HP488

Post by mircea2012 »

Hy.

I am beginner in microcontroller programming and i need some advice.
First i bought a development board HP488 from MatrixMultimedia. This board has a pic microcontroller namely PIC17F88 - with 16 I/O pins.
Can somebody explain me what means Pull-up (PORTB Pull-up Enable bit - option_reg bit 7 ) ? What is happened if this bit is enabled/respectively disabled ?

I made a programm who must realize the next tasks :
- if button SB0 is pressed once SA0 led is ON.
- if button SB0 is pressed for the second time SA0 and SA1 leds is ON.
- if button SB0 is pressed for the third time SA0 ,SA1 and SA2 leds is ON.
- if button SB0 is pressed for the fourth time SA0 ,SA1, SA3 and SA4 leds is ON.
Thank you.

#include <system.h>
#pragma CLOCK_FREQ 19660800
#pragma DATA _CONFIG1, _HS_OSC & _WDT_OFF & _LVP_OFF

void main(void)
{
trisa = 0xF0;
trisb = 0x01;
porta = 0x00;
int count = 0;
while(1)
{
if ((portb & 0x01) && (count == 0)) // if button SB0 is pressed once SA0 led is ON.
{
porta = 0x01;
count++;
}
if ((portb & 0x01) && (count == 1)) // if button SB0 is pressed for the second time SA0 and SA1 leds is ON.
{
porta = 0x03;
count++;
}
if ((portb & 0x01) && (count == 2)) // if button SB0 is pressed for the third time SA0 ,SA1 and SA2 leds is ON.
{
porta = 0x07;
count++;
}
if ((portb & 0x01) && (count == 3)) // if button SB0 is pressed for the fourth time SA0 ,SA1, SA3 and SA4 leds is ON.
{
porta = 0x15;
count = 0;
}
}
}

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: HP488

Post by Benj »

Hello,

I think this bit enables or disables internal pull up resistors (approx 100K) on each of the PortB pins.

Post Reply