68HC11

hi there, im not too sure if this is the right place to ask for help for 68HC11 but i would like to ask if anyone knows how to program the PortA of the
68HC11 so tat it is able to take in inputs from a zero crossing circuit and then be able to control a dimmer circuit? would appreciate any help rendered.. many thanks.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

So... what does the input from the zero-crossing circuit look like? What does the output to the dimmer circuit look like? An HC11 is really easy to program, but you sort of have to know what the hardware is first....
--
Joseph J. Pfeiffer, Jr., Ph.D. Phone -- (505) 646-1605
Department of Computer Science FAX -- (505) 646-1002
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
The zero crossing circuit uses 12VAC running thru a phototransistor CNY17-3 with a 54K resistor and a 1N4007 across pin 1 and 2 of the CNY17-3, the other side of the CNY17-3 is connected with a series of capacitors and resistors coupled w/ a BC547 NPN transistor where the output from the zero crossing is tapped from the collector of the BC547.
The dimmer circuit was constructed relatively easily since i just followed the application notes on the optocoupler MOC3021 and used a triac SC140, the control of the dimmer would come from Pin1 of the opto since i've previously tested by running an output from a full bridge rectifier connected to an LM741 generating a simulated zero crossing however with a variable resistor acting a manual dimmer.
I understand the 68HC11 is a relatively simple MCU however, being out of school quite a while already and trying to understand it still gives me the headaches.
------
Joe Pfeiffer wrote:

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Xronocruz wrote:

The approach I would use is (a) have the zero-crossing signal trigger an interrupt which loads a timer with the desired dimming value (that is, the time after zero-cross at which you want to turn on the triac -- longer timing values result in greater dimming), and (b) a timer interrupt which turns on the triac. For example, if your desired dimming value is 5ms:
Zero-crossing interrupt: -- Load timer with dimming value to produce 5ms delay -- Start timer, which is configured to generate an interrupt on timeout
After 5ms, timer will generate its interrupt: -- Turn on triac -- Stop timer, if it doesn't stop automatically
This sequence will happen every zero-crossing, or every 8.33ms for 60Hz AC. Outside of the interrupts, your code will be altering the dimming value based on some form of input (user switches or potentiometer, commands received via the serial port, etc). What you need to figure out is how to set up the processor to generate the zero-crossing interrupt, and how to set up a timer to generate the timeout interrupt, and how to use an output bit to turn on the triac.
Hope this is what you were looking for.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
hello mike,
thanks for the insight, i have written a code for the initialization from a keypad input already and that i'm able to detect and show on a 7-seg display the user input from the keypad. But the main problem im facing now is that i'm unsure or probably im looking at all the wrong directions. The following is the kind of psuedocode im following
1)Main 2)Initialize subsystems 3)Wait for user input 4)store user input 5)update register
Interrupts 1) Initialize timer with registers(register value will be taken from the previous update above from the user input) 2) trigger diac(MOC3021) 3) return
however i've got no knowldge in programming interrupts in assembly or C and getting it to merge 2gether with the main program, so far i've juz been doing a lot of hard coding. would appreciate if anyone could provide me with some links or perhaps an example code for the usage on a 68HC11 its the setup for the input of the zero crossing and output to the diac i'm having problems with some of the article i've read they provide the entire code however they do not specify like to which pin the zero crossing and the dimmer is connected to. One such article is written by Eric Gunnerson...http://www.nutsvolts.com/PDF_Files/light_effects.pdf#search=%22eric%20gunnerson%20dimmer%22 i do understand the theory behind it but the main application on board the 68HC11 is what thats troubling me.
Mike Silva wrote:

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Xronocruz wrote:

Basically, the timer in a 68HC11 is a 16-bit free running timer. Each clock cycle it goes up by a count of 1. There are several support registers around the timer.
One is an Input Capture Register. When a selected edge is triggered, it captures a snapshot of the timer just then. You will connect the PortA line for this Input Capture to the zero crossing detector, NPN transistor's collector with a pull up (typ. 3.3K).
When the edge comes in it will generate an interrupt. The interrupt routine will use the snapshot of the register and add to that value an offset, the delay in cycles for how long after the zero crossing the triac should be energized.
The computed value should be stored in an Output Compare Register. When the timer and the compare register contain the same value, an Output Compare will occur. The output line on PortA will be set/reset/toggled depending on your selection. An interrupt will be generated.
This second interrupt routine should clear the setting to set/reset/toggle PortA action after this first one. The first interrupt will need to set to enable the action. Also depending on the width of the pulse, the second interrupt routine will probably need to clear or reset the pulse.
Proper initialization of the registers is required to set this up and begin operation. The edge the Input Capture operates on, the action of the Output Compare, enabling of the two interrupts and the setting of the interrupt vectors.
Because of the latency of the processor response to an interrupt, there is a limit how closely the triggering of the triac can come behind the detection of the zero crossing.
--
Randy M. Dumse

Objects in mirror are more confused than they appear
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.