So i was having trouble the other day with a circuit I was testing and my oscilloscope going bonkers. I did not know what was going on, so I did some investigating and low and behold my homebrew power supply was acting up and had massive amounts of noise and ripple on all the power rails. So i grabbed a couple of these off ebay cheep, thinking well if they are crap i will send them back. Checked the ripple on the output and its not bad at about 100mv, not the greatest, but not bad enough to cause the scope to act up. Time will tell how they go. About the only thing I really need is a 3rd channel. I often need to run 2 12v rails and a 5v. So im going to have to hack up some dual leads. I went looking for double adaptors with 4mm banana and dual terminals, but they just don’t exist anywhere i can find anyway LOL
So while working on the code for the control board part of the receiver project, I came across an interesting conflict. The keyboard and the rotary encoder did not want to play nice with each other than and the compiler was spitting out an error about a vector conflict. Keyboard worked fine by itself and the rotary encoder worked fine by itself but put the code for both into the once program and the compiler went bonkers.
So i set about learning everything i could about interrupts on the Mega 2560. And this was where the fun began and i ended up going down a rabbit hole from which i was lucky to escape. Well i did survive and i did actually learn about interrupt vectors, pin change interrupts and external interrupts and a little about library conflicts along the way.
So this is not really a tutorial on using interrupts or the differences between pin change or external, but rather a rant about the 2 hours I spent last night reading and trying to understand what I had done and why there was a conflict. In the end it was because i programmed the rotary encoder to use pin change interrupts and it was the library i used that was in conflict with the keyboard library. I did not know that was what i had done, i had assumed that using pins 18 and 19 on the mega, being the external interrupt pins just worked in one way only. But no no no, they can be either external or pin change interrupts depending on how you code for it. Yes, a very rookie mistake.
So after finally working out what I had done wrong, or in reality why the libraries were in conflict, i changed 2 lines of code and had the rotary encoder working as it should be with the keyboard and everyone is happy. So at the moment I have a working keyboard, rotary encoder and VFO and now that my work week is done, I will hit the code hard tomorrow and make some real inroads into getting features in there that I want in my radio. Its not going to be as pretty as the Nextion vfo codes that are floating about the internet, but its going to be all mine. And sometimes, its good to know you have rolled your own and it does what you want.