Hey Anand,
Still using the 628A ?
and what OSC ?
I think I have something for you.
DT
Hey Anand,
Still using the 628A ?
and what OSC ?
I think I have something for you.
DT
Last edited by Darrel Taylor; - 5th May 2006 at 05:49. Reason: Come on... get your butt outta bed, this is Cool!
Hi Darrel,
Yes, still on the 16F628, with the internal 4 Mhz oscillator, although I'm hoping to migrate it to an 8 pin (or even 6?) device.
I could of course use an 12F683 as Dave pointed out, but I'm still curious to see if this can be done without the HPWM module.
Very eager to see your suggestion!
Anand
Dave, thanks for the inputs. I could not have designed the actual hardware interface to the mains without your invaluable pointers to powerline carrier articles.
Are you suggesting that X10 signals would be better generated in PBP without using the XOUT macro? My X10 transmitter is a very basic one, so the micro dim/brights are not an issue.
I would have loved to have some extended commands though.
Again, a heartfelt thanks.
Anand Dhuru
4mhz! You don't believe in making things easy do you.
I believe it can be done on any pin, without any hardware modules, CCP or Timer, and no Interrupts.but I'm still curious to see if this can be done without the HPWM module
Last time, we used the CCP module to create the 120khz, then used XOUT to turn that output on and off. But during that 1ms period that it's sending a "1", the XOUT command is just spinning it's wheels in a PAUSEUS 1000.
Instead of just sitting there letting the hardware do all the work, why not just create the frequency in software for 1ms and be done with it.
Once again, I've never done this, but maybe I can get lucky twice in a row.
For a 120khz signal of 1ms in duration, we need to create 120 cycles.
Each cycle is 8.3333 us (1/120,000).
@ 4mhz it doesn't divide perfectly, so the closest we can get is an 8us cycle which ends up at 125khz. I hope that's close enough.
First off, in your main program, make a variable like this to use for counting the cyclesCode:LoopCounter VAR BYTE $20 SYSTEM
Now let's go back to the PBPPIC14.lib file. Un-Comment the LOWT line that we had commented previously. This gives back control of the TRIS register to the XOUT command.And, change the xout1loop that we modified before, to this ...Code:ifdef XOUT_USED LIST XOUT2 movlw 2 ; Default to 2 cycles XOUT movwf R2 ; Save number of cycles movf RR1, W ; Get data port movwf FSR ; Put it into FSR movf RM1, W ; Get data bit mask call LOWT ; Set data to low, outputThen, using it should be like normal again ...Code:xout1loop movlw 120 ; 120khz for 1ms = 120 cycles movwf LoopCounter xout120loop ; ---- 1 cycle of the 120khz --------------------- movf RM1, W ; 1 Get data bit mask iorwf INDF, F ; 2 Set the bit nop ; 3 waist some time comf RM1, W ; 4 Get inverted data bit mask andwf INDF, F ; 5 Clear the bit decfsz LoopCounter, F ; 6 Are we done yet? goto xout120loop ; 8 NO. Do it again.Once again, Fingers crossedCode:XOUT PORTB.3,PORTA.0,[house\lightsOff]
<br>
DT
Time to raise my hat again! That was superlative, Darrel. Worked the first time (that is, as soon as I remembered to switch off the CCP module enabled for the earlier version!). And of course, I confirmed it works as well on any other pin.Originally Posted by Darrel Taylor
Thanks a ton.
Anand
Fantastic!
My luck seems to be getting better.
I'm thinking it's time for a trip to Vegas.
You're very welcome, and thanks for the fun project.
DT
P.S. Dave's idea sounds pretty good too. More control.
And Jeff might be happier without us messing with his macro's.
I would love to see an example for the 12F683.Originally Posted by Darrel Taylor
I think the best approach is to create a procedure (using ASM or using the CCP module) to generate a 1ms burst of ~120kHz and then call it as needed from PBP. That gives you the flexibility to send arbitrary patterns. If you also use Darrel's Instant Interrupt's, you can do the X-10 part in the background, sending a manchester half-bit at each zero-crossing.Originally Posted by ardhuru
Using the CCP module, you could even use a timer to end the ~120kHz burst and do single or 3-phase in the background with minimal loss of processing time. This would also allow you to listen to the powerline during manchester 0 half-bits to detect collisions. Note that it does no good to listen if using a TW523 or equivalent as it delays its output by 22 powerline half-cycles, acting like a 22-bit shift register with the powerline frequency as its clock.
Anand,Originally Posted by ardhuru
There may soon be another possibility. SmartLabs tells me they will release their powerline chips this month. They will cost less than $2 even in single quantities and can do both X-10 and Insteon.
Hi Dave,
that sounds like a very useful product indeed; almost like a TW523-in-a-chip solutoin. I would look forward to its release.
In the mean time, my home brew circuit with off the shelf part also seems to be holding its own. In fact, the transformer I used (one from the set used in AM radios), gives out a signal 2 to 3 times in amplitude as the one from the RR501/TM751.
Regards,
Anand
Bookmarks