CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

X10.c troubles

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
reyes33d88



Joined: 18 Apr 2013
Posts: 7

View user's profile Send private message Send e-mail MSN Messenger

X10.c troubles
PostPosted: Thu May 30, 2013 2:03 pm     Reply with quote

Hi guys, I have the next code:
Code:

void main()
{
set_tris_b (0x00);                ///PUERTO B COMO SALIDA

while(1){
  if(input(pin_a0)){         //LA INFORMACIÓN LE LLEGARÁ POR A0
    x10_read( 'A', 1);       //LEE LA DIRECCIÓN A 1
    delay_ms(50);            //ESPERA 50 ms, T=0.01666 X 3 = 50 X 10-3
    x10_read( 'A', 20);      // SE LE ENVÍA LA INSTRUCCIÓN DE ENCENDIDO A LA UNIDAD A 1
    output_high(Pin_B2);             
    }
  else
    output_high(Pin_B2);
 }

}

My main trouble is when I send another code like A 2, and after A 20, but the system do the same if I send any command, what can I do? Thank you
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu May 30, 2013 3:34 pm     Reply with quote

I don't understand what your problem is. Please tell what you want to happen and what you see that happens.
Have a look at your output to B2, it never goes low again.
reyes33d88



Joined: 18 Apr 2013
Posts: 7

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Thu May 30, 2013 5:32 pm     Reply with quote

Thank you, well, I sent the command A 1 after the instruction, and all is well, but when I sent another command like A 2, the receiver do the same like A 1, this is my problem.
gpsmikey



Joined: 16 Nov 2010
Posts: 588
Location: Kirkland, WA

View user's profile Send private message

PostPosted: Thu May 30, 2013 10:12 pm     Reply with quote

I have not played with that, but do you need to have a delay after the second one before setting the pin high so it can complete sending? Also, if you are sending, why are you calling "x10_read()" - isn't there a write command or am I missing what you are trying to do ?

mikey
_________________
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Fri May 31, 2013 5:34 am     Reply with quote

Mikey has a good point. The driver being used in the CCS x10.c from the driver directory. Here are defined functions for writing, reading and testing if data is ready to be read.

The program as shown here is wrong as it used the read function for writing. The read function expects pointers as parameters, not the values as given here, those will lead to random memory corruption bugs.

I recommend the topic starter to have a look at the CCS provided example program EX_X10.C, it is located in the PICC\Examples directory where you installed the compiler.
reyes33d88



Joined: 18 Apr 2013
Posts: 7

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Fri May 31, 2013 1:22 pm     Reply with quote

Thanks for your comments, then that means that with this program only can a X10 transmitter? a receiver can not be programmed with this library? If so, I can not say that I will program a pic, which will drive A 2 and do a light on? was needed for this transceiver TW523?, is that they are many questions, but any of you have done something like that for, thank you very much for your attention
javi.ar



Joined: 17 Feb 2006
Posts: 59
Location: Argentina

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Wed Jun 05, 2013 9:35 pm     Reply with quote

One question, I am also dealing with x10 , I have the trouble with the detector of the presence of the 120khz , did you made some progress with it? Thanks a lot.
reyes33d88



Joined: 18 Apr 2013
Posts: 7

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Wed Jun 05, 2013 9:57 pm     Reply with quote

hi javi, could you send me an E mail?, reyes33d88@hotmail.com
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group