28.12.24
PIC 16F688 - 1 sec interrupt demo
The 1-sec.
This is a small demo on how to use interrupt to flash a led at a 1 sec rate.
PIC16F688 have one 8-bit timer. This means that the max value TMR0 can have ...
26.12.23
Read the GPRMC sentence
How to read the RMC sentence from a gps.
This litte program reads the GPRMC sentence from a GPS module, and display it on a screen.
29.12.24 PIC 16F688 ADC to RS232 Introduction All the Uart - code is in the uart_header and uart_source files. 03.01.25 PIC 16F690 - Engine Timer This is the program running on the PIC 16F690:// INCLUDE LIBRARIES
This little program reads the ADC value from AN7, and transmits the value to the TX pin.
// INCLUDING LIBRARIES
#include < xc.h >
#include < stdio.h >
#include < stdlib.h >
#include < string.h >
#include < stdbool.h >
/...
29.12.24
PIC - Toggle an LED using a Hall Effect Sensor
Here's a little C program for a PIC microcontroller that toggles an LED based on input from a hall effect sensor:
#include < xc.h > #define _XTAL_FREQ 8000000 // Set your oscillator...20.05.24
PIC16F690 - LCD counter - The software
New updated version of the Engine Timer
This is a work in progress, and the code is not finished. It need some comments
The code has been slightly change. Now we're...29.12.24
PIC16F628A - RGB LED Fade in and out
This program utilize the functions from RBG leds. It starts with the red color. The red color of the RGB is faded in and out 3 times. Then it moves on to the green color. Same here. Fades in and ou...
29.12.24
PIC16F628A - Move a servo motor 45 degrees
These lines of code moves a servomotor 45 degrees and back. We're not using any timers, but make the PWM signal manual with a for-loop.
// INCLUDE LIBRARIES #include < xc.h > // CON...02.01.25
PIC12F1822 - Blink a LED __delay_ms - version
This is the basic of a program to blink a LED connected to PORTbits.RA4. The LED blinks at a rate of 500ms. The program use the delay function, which isn't very good, because the MCU halts/stops fo...
03.01.25
PIC12F1822 - Fade an LED in and out
This program fades an LED in and out. The LED is connected to RA4.
// INCLUDE LIBRARIES #include < xc.h > // CONFIGURATION BITS // CONFIG1 #pragma config FOSC = INTOSC //...05.01.25
PIC12F1822 - Fade 6 RGB LED in and out
This program in close to this, but for another MCU. It does the same thing, but we're using all I/O-pins except one. Althoug...
21.04.25
PIC16F690 - 4 digit 7 segment hour counter
In this article I'm using a PIC 16F690.
#include < xc.h > // remove the extra spaces #define _XTAL_FREQ 4000000 // CONFIG #pragma config FOSC = INTRCIO #pragma config WDTE = OFF #prag...29.07.25
PIC16F690 - Day 1: Project setup & basic I/O
Day 1: Project Setup & Basic I/O
Goal: Set up MPLAB X, create a project, and control LEDs using PORTB.
Concepts: Configuration bits, TRIS/PORT/LAT registers
Co...29.07.25
PIC16F690 - Day 2: Input Handling (Button Input)
Day 2: Input Handling (Button Input)
Goal: Read a button input connected to RA3. Toggle an LED on RB0 when the button is pressed.
Hardware: Button with 10...31.07.25
PIC16F690 - Day 3: Output Multiplexing Basics
Goal: Learn basic multiplexing by lighting multiple LEDs one at a time in quick succession to give the illusion of being all on.
Hardware: 4 LEDs connected to RB4–RB7 (with resi...09.08.25
PIC16F690 - Day 4: Introduction to Timers(Timer0)
Goal:Learn to generate accurate delays using Timer0, comparing it with software delays.
Timer0 is an 8-bit timer with optional prescaler and interrupt support.
We'll blink an LED ever...10.08.25
PIC16F690 - Day 5: Combined Interrupts – Timer0 + Button Input
Goal:Learn to combine multiple interrupts:
Use Timer0 to blink an LED (every 500 ms)
Use RB4 input to toggle whether the blinking is enabled
Hardware:LED on RB0
...
nerdegutta.no