In a bid to get rid of the strange noise shown on the traces in previous posts I've tried using the pulseout command.
Whilst its still not perfect as the pusle width can go down to zero, the resulting squarewave that the PIC outputs is a lot cleaner as can be seen by the attached image
I'm going to get some power transistors tomorrow and develop the output stage based on a few examples I found in an old book I used some 25 years ago and see how it performs.
Here's the code if anyone is interested.
Code:@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON TRISIO.2 = 0 'Set GPIO.2 to output. ANSEL.2 = 0 'Set GPIO.2 to digital GPIO.0 = 1 'gpio.0 set to input VRCON = 0 ' Voltage reference disabled OPTION_REG.7 = 0 DEFINE ADC_BITS 8 ' Set number of bits in result DEFINE ADC_CLOCK 3 ' Set clock source (rc = 3) DEFINE ADC_SAMPLEUS 50 ' Set sampling time in microseconds D var byte main: ADCIN 0, D PULSOUT GPIO.2 ,D goto main




Bookmarks