PDA

View Full Version : X-10 and the proper XOUT statement for 18F2620



JohnP
- 9th December 2007, 17:41
I've been having some problems getting an XOUT command to work.

Pic: 18F2620
PBP: 2.46
MCS: 3.0.0.5
Prog: MELABS U2
Code;
include "modedefs.bas"
.......
house = 1
unit = 1
pause 100
XOUT PORTa.1,PORTa.2,[5\5,5\uniton]
' XOUT TRISA.3,PORTA.0,[house\lightsOff]
' XOUT Sig, Zer,[house\unit,house\%11110]
pause 50

Problem: The code above is parts of the program that compiles and loads to the 2620 OK.
I have LCD outputs that help me track the programs progress and I know for sure that when the program hits the XOUT command the program "jumps" back to begin. I'm not sure whether the PIC is resetting or the program is causing the jump. The pic and the board it is on are known good units that I use for other programs. The output pins used for Data and Zero crossing have no connections, so I know the pins aren't being shorted to ground.

Does the 18F2620 & PBP combination not support the X-10 XOUT and XIN commands?

I've seen references to making some changes to the 18F2620 lib file, but don't know what or how to change.

Is anybody out there that has had this same problem and a fix?

John P
Virginia Beach, VA

mister_e
- 9th December 2007, 17:52
make sure you have disable all multiplexed Analog stuff on this pin and it should work as expected...

JohnP
- 9th December 2007, 19:24
Steve,

I'm not sure what you are referring to when you say "Multiplex stuff". I have no connections to the porta pins for RA1 and RA2. I executed a trisa %00000000 before issuing the XOUT command even though I felt it wasn't needed.

John P

mister_e
- 9th December 2007, 20:09
TRISA is nice for safety sake, what i'm talking about is the Analog features (comparator and/or adcs) that might be already enable at POR.

You want to send a digital signal, but it's not going to work pretty well if the I/O is set to analog at POR.

http://ww1.microchip.com/downloads/en/DeviceDoc/39626d.pdf

PDF page 226, ADCON1
ADCON1=$0F ' disable all ADCs

PDF page 235&236, CMCON
CMCON = %00000111 ' disable comparator.. yeah even if already disable at POR

PDF page 241 CVRCON
CVRCON = 0

HTH

JohnP
- 9th December 2007, 22:18
Steve,

I see what you mean. I turned off all analog inputs and tried again with no luck. I also tried switching to ports c.2 and c.5 with same result. As soon as the program hits any XOUT command, the PIC apperently resets or jumps back to BEGIN. I have an output message to my LCD before and after the XOUT command. I see the LCD message before the XOUT but never see the LCD message after the XOUT. If I remove the XOUT command, the program proceeds normally.

John P

mister_e
- 9th December 2007, 23:13
post your whole code, configuration fuses and schematic (if possible).

You can try to disable the watchdog timer to see if it solve some part of the problem.

Nicmus
- 10th December 2007, 20:01
Hi JohnP,

I might be wrong , but you need activity on zero crossing pin for the XOUT command to work.
Check out PBP manual page 163 (chapter 5.89 ).
Hope this will help.

Regards,

Nick

JohnP
- 10th December 2007, 22:04
Nick,

BINGO!!!!

I knew it had to be something stupid!! The program waited for the command to finish and the watchdog timer reset the PIC! Disabling the watchdog timer made everything just stop when the XOUT command was executed.

Of course, the real problem was that I didn't read the instructions in detail - I just skimmed and skimmed right past the part about "XOUT will effectively wait forever".

Thanks again for all that replied to my problem. It wasn't a problem, but an opportunity to learn -- from those that knew better.

John P