Posts From The Art of Technology

 

Hydroponics Automation Overview

I have been using hydroponics to grow various herbs, lettuces, and other food plants for some time now. It is a great way to grow fresh veggies. Recently I ventured into designing my own hydroponic systems - as you can see below - this is the test bed I have been using. I also have been working on a few iterations on...

PIC10F322 and XC8 Code – Light Activated Switch

Using the ADC module in the PIC10F322 – we are going to use a photoresistor (see previous post on Using A Photoresistor) and a Potentiometer (another post here about it) – that will turn on and off a LED based on the amount of light. The trigger point is adjustable using the Potentiometer. Of course you could instead...

PIC10F322 XC8 Interrupt Based Delay Timer

In the previous post I wrote about using the PIC10F322 Interrupt. In this post is the the complete code that will use timer0, to replace the __delay_ms() macro. Why would we want to replace the __delay_ms() macro? The macro has some limitations, great if you want to bang something out. However, the macro uses a...

PIC10F322 XC8 Interrupts – Overview

Here is a quick overview of how to get interrupts going in XC8. You will need to define your interrupt function or handler in your code. void __interrupt () isr_routine (void) { } The name isr_routine can be anything you want, however __interrupt () is very important it tells XC8 that this function should be assigned...

PIC10F322 Applications – Cascaded Timer

PIC10F322 Cascaded Timer – when input on PORT.A2 goes low – PORT.A0 will go high, for 1 second, then LOW, Then PORT.A1 will go high, for one second, then LOW. The on time can be changed by adjusting the PulseOut_Time. Of course you can move the input to PORT.A3 and get one more output on PORTA.2 and make it three...

Understanding XC8 MPLAB C Header Files

Received a question about – How to separate a program into multiple files. Simple programs can be put in a single file, but when your program grows larger, while it isn’t impossible to keep it all in one file, it starts to become a big pain in the rear. The purpose of this post is to show you how to move functions...

PIC10F322 Applications – Basic Astable

Continuing with using a PIC10F322 as a 555 replacement – Here is a basic Astable XC code. The output pulses are on PORT.A0 Run down of the code We do some basic setup to get output on Port.A0, Set the speed of the cpu to 16Mhz. The code loop, toggles PORT.A0 on and off. At 16Mhz and no delays, the output pulse is...

PIC10F322 -XC8 – Timer0 Module

The PIC10F322 has two Timer Modules – we are going to take a look at TMR0 (Timer 0). Timer 0 – is an 8bit timer/counter – that can be incremented by either an external signal or internal instruction clock FOSC/4. When the timer overflows – (reaches 0xFF and turns over to 0x00) it sets an interrupt flag that can be...

PIC10F322- XC8 Code – PWM Functions

The PIC10F322 has two PWM modules. The period or frequency of the PWM output is common to all PWM modules, whereas the duty cycle is independently controlled. The two pins where the PWM output is present are: PORT A0 PWM1PORT A1 PWM2 During setup – make sure to set the associated TRIS register and disable analog for...

PIC10F322- XC8 Code – Input or Button Debounce

XC8 Code for PIC10F320 – PIC10F322 – Input or Button Debounce I put together some code to debounce a signal on the inputs of the PIC10F32X device. Switch debouncing is one of those things you generally have to live with when playing with switches and digital circuits. If you want to input a manual switch signal into...