Hmmm, what I missed was the Polarity of the XOUT signal. The PBP manual didn't really go into too much detail, but i found another document on the web that explained it better. It's description goes like this.So, 1 turns the 120khz ON, 0 turns it off.Transmit to Power Line—Output a high on this line within 200 μ of Zero Crossing
going high, and hold the line high, to output a one on the power line—that is, to turn on
the 120 kHz oscillator. Use the same timing with a low output to output a zero. The line
should be low if the interface is not to transmit data, since that keeps the oscillator off.
But with the TRIS bit, it works the other way around. 1 = INPUT (OFF), 0 = OUTPUT (ON). Just a little backwards.
I think you're right though, the only way around it is to change the XOUT command itself. Fortunately, it's an easy change if you're willing to tamper with the PBPPIC14.LIB file.
If so, be sure to make a copy of the file before editing, you might want it back the old way later on.
Your mission, should you choose to accept it, is to ...
Open the PBPPIC14.LIB file in the PBP folder, and do a search for XOUT. You should see a section that looks like thisComment out the "call LOWT". We'll handle setting the pin to the correct state manually.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, output
Then scoll down a little bit to xout1loop and change it like thisIt just reverses whether it sets the pin high or low.Code:xout1loop ; movf RM1, W ; Get data bit mask ; iorwf INDF, F ; Set the bit comf RM1, W ; Get inverted data bit mask andwf INDF, F ; Clear the bit movlw high 1000 ; Pause 1 ms movwf R0 + 1 movlw low 1000 call PAUSEUSL ; comf RM1, W ; Get inverted data bit mask ; andwf INDF, F ; Clear the bit movf RM1, W ; Get data bit mask iorwf INDF, F ; Set the bit
Now, to use it ..Fingers crossedCode:TRISB.3 = 1 ' start with output OFF XOUT TRISB.3,PORTA.0,[house\lightsOff]
P.S. Don't blame me if you don't backup the file first.






Bookmarks