|
 |
|
01-10-2009, 03:11 PM
|
#1
|
|
Fusion Brain Creator
Join Date: Mar 2005
Posts: 2,197
|
V4 PWM firmware update
Firmware Update
Download:
http://fusioncontrolcentre.com/MDX/v4update.zip
1. Hold down the red button, plug in USB/power
2. Run PDFSUSB.exe
3. Pick the board from the drop-down list
4. Open the included hex file
5. Program
6. Execute
7. Test with MDX or with Sample VB App
MDX PWM
Software PWM: XX is in milliseconds and YY is in percent on-time
<iochannel id="Digital Output 0" port="15" brain="my fusion brain 0" type="digital_output">
<defaults defaultstate="off"></defaults>
<options mode="standard">
<pulse duty_cycle="XX" period="YY"></pulse>
</options>
</iochannel>
Hardware PWM: XX is between 0 and 127 (off to on)
<iochannel id="Digital Output 0" port="15" brain="my fusion brain 0" type="digital_output">
<defaults defaultstate="off"></defaults>
<options mode="pwm">
<pulse duty_cycle="XX"></pulse>
</options>
</iochannel>
Sample non-MDX App to Control FB
Move the sliders back and forth.
Let me know if there's any issues.
Last edited by 2k1Toaster; 01-22-2009 at 11:22 AM.
|
|
|
|
|
|
Advertisement
|
Sponsored links
|
01-10-2009, 05:55 PM
|
#2
|
|
Low Bitrate
Join Date: Sep 2007
Location: Dawson, IL
Posts: 99
|
Cant get to it, wants user name/password - used email addy/password used on your site and it wont let me in, also tried screen name/password from here - how can I get to it
Thx
__________________
If anyone gives me a rev - I give them the Bird
|
|
|
01-10-2009, 06:07 PM
|
#3
|
|
Fusion Brain Creator
Join Date: Mar 2005
Posts: 2,197
|
oh woops
try now
|
|
|
01-10-2009, 09:32 PM
|
#4
|
|
Constant Bitrate
Join Date: Aug 2003
Location: Iowa
Posts: 167
|
When I boot up the FB with the red button held down, my machine recognizes it as a v3 board, and outputs 9 and 10 oscillate at about 5 Hz. The PDFSUSB utility doesn't show anything in the drop down list.
|
|
|
01-10-2009, 10:01 PM
|
#5
|
|
Fusion Brain Creator
Join Date: Mar 2005
Posts: 2,197
|
Should show this in device manager
USB\VID_04D8&PID_000B\xxxxxxxxxxxxxxxxxxx
With this as a driver:
mchpusb.sys
|
|
|
01-10-2009, 10:06 PM
|
#6
|
|
Fusion Brain Creator
Join Date: Mar 2005
Posts: 2,197
|
|
|
|
01-10-2009, 10:35 PM
|
#7
|
|
Constant Bitrate
Join Date: Aug 2003
Location: Iowa
Posts: 167
|
Ah, much better. After I booted up the PIC in firmware mode (with the two oscillating outputs), I went into device manager and updated the driver to the bootloader driver. Once that was done, the update utility saw the device, and the firmware flash went exactly as expected. The update took only a couple seconds, and the PIC rebooted as a v4 FB.
Now using FBDemo to check it out, and the sliders do control the brightness of the LEDs. However, the buttons no longer turn the outputs on and off. What changed in the byte stream? Are you using all 8 bits of the first byte for the PWM value, or are you only using 7 like the earlier details indicated?
|
|
|
01-10-2009, 10:47 PM
|
#8
|
|
Fusion Brain Creator
Join Date: Mar 2005
Posts: 2,197
|
the buttons turn them on now. To be off, the slider needs to be full left, and the output off. does it work like that for you?
|
|
|
|
Sponsored links
|
|
Advertisement
|
|
01-10-2009, 10:59 PM
|
#9
|
|
Constant Bitrate
Join Date: Aug 2003
Location: Iowa
Posts: 167
|
According to the data stream spec posted by 2k1, the first 7 bits are for PWM value (controlled by the slider), and the last bit is the on/off value, (controlled by the red/green button). Based on what I see, it looks like you are using all 8 bits for PWM value.
If that is the case, what is now in the second byte? There was a bit there to toggle between on/off mode and PWM mode.
I intended for the buttons to turn the output on/off, regardless of what the slider is set to.
|
|
|
01-10-2009, 11:12 PM
|
#10
|
|
Fusion Brain Creator
Join Date: Mar 2005
Posts: 2,197
|
the buttons turning the output on/off regardless of the slider doesn't make sense. If that's true, and you set the output to off, slider to full, the output would still stay off.
the way the code works is:
Output_PWM_Value = USB bytestream value *2 (this would be 255 maximum. 255 means full on.)
then there's a section that does this
if USB_button_bit = 1 then Output_PWM_Value =255
next
run set Output_PWM_Values to buffer
then every 42uS, an interrupt fires that compares a counter to the buffer value, and adjusts the state of all outputs accordingly
|
|
|
01-10-2009, 11:28 PM
|
#11
|
|
Constant Bitrate
Join Date: Aug 2003
Location: Iowa
Posts: 167
|
Here is what 2k1 posted, which is what my code is based on.
Quote:
Digital Outputs
2 bytes per output
[PPPPPPPS][TTTTTTMM]
P = Value of PWM
([7bit Value + 1]/128)% duty cycle
Details of full period to be determined later
S = 1bit state
0 = Off
1 = on
T = 6bits of Timer to shutoff --> [Evaluated Units in Seconds]
If 6'bTTTTTT is 0, then shut off immediately on disconnect
If 6'bTTTTTT is between 1 and 10 inclusive, then wait [6'bTTTTTT] seconds after disconnect
If 6'bTTTTTT is 11, then wait 30 seconds after disconnect
If 6'bTTTTTT is 12, then wait 60 seconds after disconnect
If 6'bTTTTTT is 13, then wait 90 seconds after disconnect
If 6'bTTTTTT is greater than 14, then wait ([6'bTTTTTT] * 10) seconds after disconnect
M = 2bit Output Mode
2'b00: Normal Full-Off or Full-On Operation Mode
2'b01: Pulse Width Modulation Operation Mode
2'b10: Yet to be determined
2'b11: Yet to be determined
The slider controls P (0-127, default is 127)
The button control S (on or off, default to off)
If the slider did everything, the button would be pointless. The only reason for the button is so you can leave the slider set on some value, and toggle the output from completely off to on for the PWM value.
Obviously the first byte doesn't work as originally documented, so how does it work? You tell me how it works, and I'll fix my code accordingly.
|
|
|
01-11-2009, 11:23 AM
|
#12
|
|
Constant Bitrate
Join Date: Aug 2003
Location: Iowa
Posts: 167
|
After a little more experimentation, here is what I find:
I tried using all 8 bits for PWM, and that didn't work right. The LED would get brighter and dimmer while slowly sliding the slider bar from one side to the other. When I just use the first 7 bits, it the LED brighness changes smoothly, as it should.
The 'S' bit in the above byte spec confuses me. When 0, it appears the slider determines the PWM of the port. When 1, the LED is just full on, without any PWM.
The 'MM' bits in the above spec also don't seem to do anything. It looks like the outputs are always in PWM mode, even if those bits are set to 00, meaning full on/off mode.
Last edited by mx270a; 01-11-2009 at 11:28 AM.
|
|
|
01-11-2009, 02:04 PM
|
#13
|
|
Fusion Brain Creator
Join Date: Mar 2005
Posts: 2,197
|
yup, that's right.
that's how i understood nick to want it via conversations with him.
when he gets back, we can tweak as neccessary.
|
|
|
01-11-2009, 02:51 PM
|
#14
|
|
Constant Bitrate
Join Date: Aug 2003
Location: Iowa
Posts: 167
|
New version of FBDemo released.
|
|
|
01-18-2009, 05:00 PM
|
#15
|
|
Constant Bitrate
Join Date: Aug 2003
Location: Iowa
Posts: 167
|
greenman, have you ever made any progress on the timers? I'd like to see the outputs shut off when data quits flowing to the FB.
|
|
|
|
Sponsored links
|
|
Advertisement
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:55 AM.
| |