Hello forum.. okay so you pull down a processor .. 16F1824 .. you configure it with the PWM component.. you get it working.. it's outputting 50% duty cycle waveform on Pin5.. RC5.. of that chip..
All good and fine.. So now I want to gate that PWM signal on.. and off.. HOW DO I DO THIS PLEASE.??
BTW - the pulse length is 600 usec.. MARK, and 600 usec SPACE... So I need - 12 MARK pulses and 12 SPACE pulses.. so that if I use say RA0 as an interrupt - IOC PORTA.. then when tactile switch presses up to VDD.. then RA0 triggers the interrupt macro.. and well - you could do your thing there... your routine will count up to maybe 24.. up and down's .. giving 12 MARK and 12 SPACE outputs...
So I thought about.. this for a while.. then started to realize that we have to switch into C code.. unless someone knows a FC way to do it..!!
What thoughts - please.??
Regards
DCW
GATING PWM output - for a number of "pulses"..??
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: GATING PWM output - for a number of "pulses"..??
Hello,
How about something like this.
The PWM output will need to be connected across to pin A0 and the trigger switch connected to A1.
How about something like this.
The PWM output will need to be connected across to pin A0 and the trigger switch connected to A1.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 64
- Joined: Mon Sep 28, 2015 8:19 pm
- Has thanked: 14 times
- Been thanked: 10 times
- Contact:
Re: GATING PWM output - for a number of "pulses"..??
Hello Ben .... GEE thanks for that...
ONCE again... you have proved yourself.. to be an OFFICER and a GENTLEMAN of the FLOWCODE.. a REAL SIR.!!
thanks very much Ben Sir.!!.. you have solved a fairly huge problem again.. now I can get along with the project...
Kindest Regards
DCW ...
ONCE again... you have proved yourself.. to be an OFFICER and a GENTLEMAN of the FLOWCODE.. a REAL SIR.!!
thanks very much Ben Sir.!!.. you have solved a fairly huge problem again.. now I can get along with the project...
Kindest Regards
DCW ...
-
- Posts: 64
- Joined: Mon Sep 28, 2015 8:19 pm
- Has thanked: 14 times
- Been thanked: 10 times
- Contact:
Re: GATING PWM output - for a number of "pulses"..??
hello forum guys... okay so I have attached a small FC7 created flowchart.. which sposed to help in creating some pulses, via the PWM logic in the chip. I using a 16F1936, with internal frequency of 16 mHz. So then the program creates first a series of 12 pulses.. with 50% duty cycle. The period of the pulses is.. 1200 usec. So at 50% .. a MARK pulse is at 600 usec width, whilst the SPACE pulse is at 600 usec width. After this is complete.. the program carries on with the next stage.. after a 4 ms delay. The next stage, has to create a 32 bit pulse train, where the MARK/SPACE ratio of the pulses varies from say 400 usec = MARK pulse, to 800 usec = SPACE pulse. So the program does loop and create the 32 pulses.. but when the pulses are generated, there is a macro called, which reads a 'digit' from an array file..(compiled into the C-code)..LUT..(LookUp Table).. So as the macro reads the array.. the values are 'index'ed off .. with index variable incrementing, so that the variable 'digit' has the value of the 'index'ed read from the LUT array.. So the first 'digit' should be.. a '0' at 'index' position 0.. and then the second, third, fourth, and fifth 'digit' should be '1' values with incrementing 'index' value, accordingly.. So this happens.. okay..(or is it.??).. When we get to the 6th place in the array.. (load the FC7 flowcode file.. go and look at the array in the LUT.. component...), we should be having a '0' in the 'digit' variable.. which sposed to be sorted out to be a wide pulse.. so the PWM1 component.. will then output a pulse of 800 usec width.. BUT IT's NOT..!
So anyone maybe interested.. in helping me find my SIMPLY STUPID fault... in the FC7 file..
Okay forum guys... anyone may help.. please... thanks.. folks..
If you look at the photo.. of the waveforms.. you can clearly see the different widths of the pulses... The first 12 pulses are there on the left side.. not all shown.. but the 32 bit pulse train sposed to be varying in widths.. of each pulse depending on the value of either 0, or 1 read from the array file.. of the LUT..
Thanks very much..
Kindest Regards
DCW..
So anyone maybe interested.. in helping me find my SIMPLY STUPID fault... in the FC7 file..
Okay forum guys... anyone may help.. please... thanks.. folks..
If you look at the photo.. of the waveforms.. you can clearly see the different widths of the pulses... The first 12 pulses are there on the left side.. not all shown.. but the 32 bit pulse train sposed to be varying in widths.. of each pulse depending on the value of either 0, or 1 read from the array file.. of the LUT..
Thanks very much..
Kindest Regards
DCW..
- Attachments
-
- PW waveform output of the flowchart-image2.JPG (112.3 KiB) Viewed 3851 times
-
- PW-generator-for testing 1936-FLowcode7.fcfx
- simple flowcode 7 file
- (21.62 KiB) Downloaded 254 times