Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

reciever/pic12f675 help

Status
Not open for further replies.

crhannah

New Member
Hello all,

I'm working on coding a couple pic chips within a transmitter/reciever system.
I've posted previously about this subject here

https://www.electro-tech-online.com/threads/12f675f-coding-help.29192/

I do still have a couple questions that hopefully someone can bring some clarity to.

As said in the previous post the system will control 2 independent devices in which a remote control will be able to turn on/off and dim. In order to dim I have chosen to use a variable resistor (pot) connected to the A/D GPIO. The code will be setup to store that 8bit code in a register and sent as the command byte of the data packet. The data packet being the id code (device 1 or 2) and command code (level of brightness).

Now for the questions lol -

I've built a zero crossing detector on the reciever side hooked up to a optoisolator/triac connect to the wall 110V outlet.

What is the best way to time when the microcontroller will send a pulse out with respect to where the zero crossings are? What would the code look like? on a side note: what exactly is happening when a zero crossing takes place? Is the microcontroller reciever a short pulse? If so, How do i take those reference points, start the counter, compare the counter values to that of the command code, and fire a pulse to the triac?

I realize i am going to need a counter probably counting up to 255. 0 being the light off and 255 being the light on.

Sorry for the long post, I just didnt want to sound like an idiot that doesnt do research.
 
The microchip website has some application notes about lighting control you may want to look at those if you haven't already done so. I've never done any lamp dimming projects before so I'm no expert. What comes to mind is with a 60 Hz line frequency each half cycle lasts 8.3 ms. The zero cross detector gives a pulse at the beginning of each half cycle, when the PIC sees this pulse it waits a set amount of time before turning on the triac. The earlier in the cycle it turns on the triac the brighter the lamp will be.
I would try.

1. load brightness value into timer register.
2. when zero cross detected start timer.
3. when timer overflows fire triac.
4. stop timer, reload brightness value.
5. goto step 2.

I would guess the tricky part would be receiving the wireless data and updating the brightness value without noticeable flickering of the lamp.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top