Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Getting inputs to work with PIC chips

Status
Not open for further replies.

arcadium

New Member
Hello all,

I'm working on a project right now using a PIC Microcontroller. More specifically, I'm using the PIC16HV785. However, I have never ever managed to get inputs to work, regardless of the MCU I use. Obviously I'm doing something wrong.... I follow example diagrams and example software, but for some reason, it doesn't work! Ouputs I have no problem with.

Are there any common downfalls? These MCUs all seem to be pretty tolerant of not using pull ups, using pull ups, using various crystals/resonators. I am using 8MHz crystal and I think 256 pre-scaler. The examples I follow are always slower crystals (not so easy to get hold of these days). Am I going too quickly for the switch input?

The other thing I am wondering, is whether it is easy to drive a 12v output without the use of a relay? The O/P from the microprocessor is 5v, but can it be passed through a few darlington pairs to drive 12v? I've also looked at using optocouples, but again, they're something I'm not familiar with.

Any advice is greatly appreciated! I have trawled the world wide wonderweb and checked that my software has the correct oscillator settings etc etc, I've used pull up resistors, not used pull up resistors, changed the MCU, started over again! I think I hold a high percentage of the world's copper reserves just in vero-board!

Thanks!
 
If you've never managed to get an input to work I suggest you get a lower spec PIC and try my tutorials, once you've seen how those work, then try migrating to the larger one.
 
PIC Tutorial

Hi Nigel,

I think that's sound advice there... One of my downfalls is that I tend to deviate from diagrams. For example, I have the PICKIT2 programmer, so I tend to try and build in an ICSP function, AND use a different MCU sometimes. I have read and referred to your site many a time, and to be honest, it has probably been the most helpful out there - Without it, I wouldn't have even got this far, so thanks for putting that together! It is greatly appreciated!

So maybe I should look at taking a step back, follow your tutorials to the letter, make a stand-alone programmer rather than going for ICSP. The reason I went with the 16HV785 to begin with is because I believed that because it was high voltage, it would be good for 12v. Not realising that it just simply has a 5v reg integrated.... either way my circuit needs a 7805 to run it from 12v!
 
You don't need to make a standalone programmer - just a ZIF socket connected to your PICKit2 - that's all it needs to make it a standalone programmer.

You could always add an ICSP socket to the tutorial boards (I have for my 28 pin one, and run it from a PICKit2), but the 18 pin board is a little lacking in pins to do that.
 
Inputs working!

Thanks for the advice Nigel!

I've got inputs and outputs running quite nicely, almost! The problem it looks like I'm experiencing, is drastic changes in oscillator frequency. The circuit I've made is connected and powered directly from another device, and I notice when there is large currently draw from the host device, such as when all lights are illuminated, the oscillator slows down, by around 10-20%. Is there a solution to this?

Thanks again!
Chris
 
That is a good question! External crystal 8Mhz. Not sure whether AT cut crystal or not. Using 15pF load capacitors. Would it be a potential issue if the crystals are low profile? I have also tried using a ceramic resonator, but the signal is not as good as with the crystal.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top