Pic Lab, PIC18, Experiment #1.1, UART / USART (updated version)

Recently, I was constantly struggling with the fact that microchip was removing more and more support libraries, so it was not wise to rely on them in all projects. Anytime I return again to my old functions – if it used the support libs, there is a pretty good chance it is screwed.

So this code works with XC8 version 2.36 and doesn’t require the involvement of extra support lib.

Continue reading

Pic Lab, PIC18, Experiment #5, USB

When I started to dig into USB topic it was quite a surprise, the amount of efforts the smart people around the world put into it just unbelievable. Even more fascinating fact – it actually worked out. The excitement reached some saturation when I realized the prices (: Vendor ID will cost you 5 grands per year, want to use a USB logo – no problem, just add another 6 grands on the top. Now we could test the compliance of your device with our standard for n grands… The companies using USB are listed on the website www.usb.org (USB Implementers Forum – USB-IF). The curious one could just count a number of companies and calculate the profit just from the year subscription, and this thing is going on for a long long time already. Well they have definitely built an addictive stuff. I, personally, have found the usage for my projects a bit excessive, I definitely not ready to put 5 grands per year for USB in the cheap humidity sensor.

Now, there are tons of different information, it is really challenging to grasp all at once, I will be honest and won’t pretend that I got everything, have a lot of holes in the knowledge, I just need to make it alive and respond to my commands. So, what I gonna to do is to show the info which looked important to me and then will conduct two experiments on this “foundation”.

USB diagram
Continue reading

Pic Lab, PIC18, Experiment #3, ADC

I was working on a small project where I needed to catch a certain button pressed event. Sounds simple initially, but I have 10 such buttons and it means that I need to have 10 IOs, or port expander, or make a digital matrix button handler (like 3×4 keypad) but these all variants are boring, I wanted something more interesting and make something like a DAC based on these buttons which will be digitazed by the built-in ADC in pic18f14k50. Thus, we will use a single port instead of 10, by cost of the more complicated code.

Let me start as usual – from reading of the datasheet.

Continue reading

Auto enabling/disabling of the amplifier

A situation in place was the next – my half done amplifier was working already 3 years just proving the statement “there last longing device is a temporary one”. It was kind of fine – but it consumes an energy. In a fact a solid chunk of the energy – it is class A amplifier. At some point in time I started to think – why to not switch on/off the amplifier in dependence on the signal presence.

the pcb for auto turn on/off feature
Continue reading

Low VDD detector

I have added a small additional pcb for my diy amp project, which is dedicated to detect the drop of VDD voltage level and saving the data to EEPROM at reaching of the certain threshold. All how I described here, I used the built-in comparator from PIC168f877a.

additional pcb on top of main diy amp pcb

It is a pity that I have not added this feature to the main pcb, so now all solutions looks unaesthetic.

Continue reading

Pic Lab, PIC16, Experiment #23: Saving data to EEPROM before the power off event

I guess, that sooner or later any developer has a question in his head – how do I save the data if the supply shut down?

There are some solutions listed:

  • The reserve battery (the RTC clock, the motherboard);
  • The constant saving to the memory – not nice, the EEPROM has limited cycles;
  • Saving to the external memory – the complication of the PCB and the code;
  • Saving when the lowering of the vdd level is detected – that what I need!
The voltage detector
Continue reading

Remote control for the fan

It was a hot, really hot, really very hot summer in 2012 in place where I used to live. I bought some cheap fan, though it was quite powerful, but there were two major drawbacks for me:

  1. No remote control
  2. No timer for scheduling switching off, let say at night. And I did not want it to make noise a whole night.
a fan with the remote control
Continue reading