So I have PWM working on the PIC 16F684A. I intended to use it with the DC motor controller based on the L298.
Well, PWM into the I1 and I2 inputs (the direction inputs) works fine, but PWM into the Enable input causes the circuit to screw up in some way, it looks like perhaps trying to drive the motor in two directions at once. My theory was to move the I1 and I2 lines to indicate direction, and use the enable to provide the PWM slow-down of the windshield wiper motor. I think I blew out a 16F684A in the process of testing.
Now I need to change things around to PWM into the I1 and I2 inputs, and just leave Enable tied to high. Since the 16F684 only has one PWM output, I am either going to have to use it with an AND gate to gate the I1 and I2 signals, or I could go back to the drawing board and make my own I1 and I2 PWM outputs using times interrupts on the 16F684A. I'm a big believer in reducing chip count, and I'd like to learn about timed interrupts on the PICs, so I will try to do it the latter way, and if I fail, I can just throw an AND chip at the problem.
Sunday, October 30, 2005
Friday, October 28, 2005
PWM example on 16F648A
Yep, I've got PWM working fine on my 16F648A...
title "Blame PWM test"
list p=16f648a,f=inhx32
#include
__config _INTOSC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _BODEN_OFF & _MCLRE_OFF & _LVP_OFF
org 00h
goto Start
org 0x005
Start
BANKSEL PCON
BSF PCON,3 ; clear bit 3 of pcon (OSCF) for 4 kHz operation.
MOVLW 0xFF ;PWM value
BANKSEL PR2
MOVWF PR2
BANKSEL CCPR1L
MOVLW 0x1F ; 50% duty cycle = 0x7F
MOVWF CCPR1L
;note, I'm ignoring the duty cycle LSBs at CCP1CON<5:4>
BANKSEL TRISB
BCF TRISB,3 ;make CCP1 an output
BANKSEL T2CON
BSF T2CON,2 ;enable timer 2
BSF T2CON,1 ;1:16 prescaler
BANKSEL CCP1CON
BSF CCP1CON,3
BSF CCP1CON,2 ;configure CCP1 for PWM
loop GOTO loop
end
Tuesday, October 25, 2005
New PIC chips
There seem to be all kinds of new cool PIC chips, good info here. In particular, the 16F819 has 5 channels of A/D, I might use this for the next generation Sycophant.
The current Sycophant IR proximity detectors are used in a binary fashion, either someone is within range or not. But the detectors are actually analog, so they could be used in a more intelligent way.
In particular, I noticed that when installed in a crowded room, Sycophant locks up because the crowd will end up being "in range" for more than one detector. With A/D, I could have Sycophant's head always move towards the IR detector which indicates someone is closer. In addition, the minimal distance for activating movement could be set in software instead of with a trimmer potentiometer.
The current Sycophant IR proximity detectors are used in a binary fashion, either someone is within range or not. But the detectors are actually analog, so they could be used in a more intelligent way.
In particular, I noticed that when installed in a crowded room, Sycophant locks up because the crowd will end up being "in range" for more than one detector. With A/D, I could have Sycophant's head always move towards the IR detector which indicates someone is closer. In addition, the minimal distance for activating movement could be set in software instead of with a trimmer potentiometer.
Wednesday, October 12, 2005
Note to Self: PIC compilers
The HI-TECH PICC-Lite compiler is a freeware version of our the PICC compiler and supports the 16F877, 16F877A, 12F675, 12F629, 16F627, 16F627A, 16F684, 16C84, 16F84 and 16F84A devices.
The 16F684 has 8 A/D and 2 comparators and is in a 14PDIP. It isn't a target for the MPLAB IDE version I have, I'll have to get a newer version and check it. The 16F877A is supported by MPLAB, has A/D and comparators, but is a big 40PDIP. The 12F675 has 4 A/D and 1 comparator, but is a little bitty 8PDIP.
On the other hand, this PIC BASIC compiler works with: 12F629, 12F675, 16F627, 16F627A, 16F628, 16F628A, 16F630, 16F648A, 16F676, 16F684, 16F688, 16F72, 16F73, 16F74, 16F76, 16F77, 16F737, 16F747, 16F767, 16F777, 16F83, 16F84, 16F84A, 16F87, 16F88, 16F818, 16F819, 16F870, 16F871, 16F872, 16F873, 16F873A, 16F874, 16F874A, 16F876, 16F876A, 16F877, 16F877A.
The 16F684 has 8 A/D and 2 comparators and is in a 14PDIP. It isn't a target for the MPLAB IDE version I have, I'll have to get a newer version and check it. The 16F877A is supported by MPLAB, has A/D and comparators, but is a big 40PDIP. The 12F675 has 4 A/D and 1 comparator, but is a little bitty 8PDIP.
On the other hand, this PIC BASIC compiler works with: 12F629, 12F675, 16F627, 16F627A, 16F628, 16F628A, 16F630, 16F648A, 16F676, 16F684, 16F688, 16F72, 16F73, 16F74, 16F76, 16F77, 16F737, 16F747, 16F767, 16F777, 16F83, 16F84, 16F84A, 16F87, 16F88, 16F818, 16F819, 16F870, 16F871, 16F872, 16F873, 16F873A, 16F874, 16F874A, 16F876, 16F876A, 16F877, 16F877A.
Monday, October 10, 2005
Art-O-Matic and Motor Controller
Friday I met with Claudia Vess and Brian Judy who ran last year's Art-O-Matic Digital Art committee. The next Art-O-Matic will occur in late October, 2006. Also attending was Philip Kohn, who exhibited at Art-O-Matic and has been doing very cool things along the lines of a mirror, except with highly modulated and distorted video.
One of the things we decided we wanted to do for Art-O-Matic 2006 is to have an "Art-O-Mobile" using mobile IP to provide a videoconference link betwen Art-O-Matic's main location and remote locations, using video projectors.
Today I built a DC motor controller kit from Hobby Engineering. It handles up to 4A, and seems to work well with the windshield wiper motor for "Blame". The wiper motor draws about 0.75 A with no load, and about 0.8A with the PVC pipe load which forms the arm of "Blame".
Here is the finished motor controller:
One of the things we decided we wanted to do for Art-O-Matic 2006 is to have an "Art-O-Mobile" using mobile IP to provide a videoconference link betwen Art-O-Matic's main location and remote locations, using video projectors.
Today I built a DC motor controller kit from Hobby Engineering. It handles up to 4A, and seems to work well with the windshield wiper motor for "Blame". The wiper motor draws about 0.75 A with no load, and about 0.8A with the PVC pipe load which forms the arm of "Blame".
Here is the finished motor controller:
Subscribe to:
Posts (Atom)