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;
}
}
}
HP488
- 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
Hello,
I think this bit enables or disables internal pull up resistors (approx 100K) on each of the PortB pins.
I think this bit enables or disables internal pull up resistors (approx 100K) on each of the PortB pins.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel