I'm using a PIC18F27K42, and part of the project requires an audio indication (beep), originally I had a piezo sounder across RA2 and RA3, bridged to make it louder. This worked perfectly well, but I was running low on I/O so thought - I'll move the piezo to RB6/RB7 instead (the ICSP pins) - and added header pins so I could connect or disconnect the piezo in case it wouldn't program with it there (and it wouldn't).
But, when I connect the piezo in circuit and the beep is called it makes a click and everything just locks up.
I've cured it by adding a 220 ohm resistor in series with the piezo, which also allows the ICSP to work - but I can't see any difference between PortA and PortB pins, so has anyone any ideas?. Doesn't really matter, because I've cured the issue - but I'm just puzzled about it?.
If anyone is interested?, I generate the 'beep' with a timer interrupt, set by this line:
Set_Beep(3, 100);
The 3 is one of a number of preset frequencies, done that way so I can alter the frequencies of a particular 'beep' all in one go (just alter the timer value that 3 refers to), and the 100 is the time of the beep in mS - you just call the routine and it runs transparently in the background.
But, when I connect the piezo in circuit and the beep is called it makes a click and everything just locks up.
I've cured it by adding a 220 ohm resistor in series with the piezo, which also allows the ICSP to work - but I can't see any difference between PortA and PortB pins, so has anyone any ideas?. Doesn't really matter, because I've cured the issue - but I'm just puzzled about it?.
If anyone is interested?, I generate the 'beep' with a timer interrupt, set by this line:
Set_Beep(3, 100);
The 3 is one of a number of preset frequencies, done that way so I can alter the frequencies of a particular 'beep' all in one go (just alter the timer value that 3 refers to), and the 100 is the time of the beep in mS - you just call the routine and it runs transparently in the background.