Shop OBEX P1 Docs P2 Docs Learn Events
serin on sx48 — Parallax Forums

serin on sx48

stefstef Posts: 173
edited 2007-06-01 14:43 in General Discussion
Hi

Thanks to you guy's I solved my latest problem with the resonator. So I could back again focus on the sx/b program. Today I created the code for the dtmf decoding and that wend all well. I programd an output (relay is connected) that wen sombody dials *9# on his phone the relay is aktivated for 10 sec. Did the same for *7# and a second relay. That is working. Now I want to read also from a serial connection to a pc and reakt on it. So I used serin RC.2, T9600, data, 100, nochar. That is reading a·byte in the data var. If nothing is recieving it is exiting the command after 100 milsec to nochar label.
I did it because else the serin command is blocking my program.
I'm using a max 233 betwien the sx and the pc.
It seems like I never recieve any·byte on it.

I double cheked with a scoop on the rc.2 pin·and thier I see the pinchange happen when thier is something send. (from hyperterminal on other pc puched on the a or b or c key). Rc.2 is getting back high if noting is going on. So the bits ar on rc.2. Why do I get nothing on the data byte??

Some sugestions.

Stef
·

Comments

  • BeanBean Posts: 8,129
    edited 2007-05-31 15:42
    Do you get data if you remove the timeout ?
    Do you get data if you use a resistor instead of the MAX233 (using N9600) ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    “The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • stefstef Posts: 173
    edited 2007-05-31 16:30
    Hi Bean

    Yes I get data if I remove the timeout. Not at the first char I send but when I send 4 or 5 times a char A (example) then I recieve something.

    Not always the same and not what I would expect. Seem something is out of sinc. I already doble cheked the baud rate but everything is fine.

    I now aded a sirout command for trying the other way and that is without any problem running fine (serout rc.3,T9600,"Q") I recieve in hyperterm always that what I send.

    I never tried without a max233. I always use that as buffer. So I realy like to keep him between. I had some problems on javeline stams if It was not used so now I 'm always putting him between. If you want I can make a temporary bypase for testing but eventualy I like to have him up and running with the max233. I thout it was no issue for using it.

    So sending is no problem but recieving gives me data but strange.

    stef
  • BeanBean Posts: 8,129
    edited 2007-05-31 16:54
    You don't have an interrupt do you ?
    Can you post your code ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    “The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • stefstef Posts: 173
    edited 2007-05-31 20:48
    Hi

    No I'm not using interrups.

    I forgot my usb stick at work. thier is my code on. I'will post it tomorrow.

    In the mean time I found something I think I did wrong. The RX line from the 233 to the sx48 has no pull up 10 K. As for the sx48 it is an input(serin) , don't you think I need to add it. All my other inputs have them.

    The output has no need of it (serout) and that one is working.

    Second I had an·compile error that thier is no·memory space left for declaring variables. I seached the manual but could not emediat find how many var thier can be in 1 sx48. I'm using Byte and word . Can you give me a·amount?.



    thanks

    Stef
  • JonnyMacJonnyMac Posts: 9,214
    edited 2007-05-31 21:44
    Memory limits are listed in the help file, and when you run out of bank 0 memory (simple variables, byte or word) the compiler will warn you.
  • stefstef Posts: 173
    edited 2007-06-01 14:16
    Hi Jonny

    I understand that now. I need more variable's. Is thier a way to use memory not in bank0 for that?? (in sx/B)

    stef
  • stefstef Posts: 173
    edited 2007-06-01 14:20
    Hi Bean

    For info.

    Found the problem wit serin. Command is working fine now. Problem was on 233. Pin 6 AND 9 need to be connected to GND. Not only 6. I think that is because off leck off sleep I made that mistake. After changing It was all working fine.

    Thanks in advance for the help. Project fror DTMF decoding is now finiched and testrunning fine.

    stef
  • BeanBean Posts: 8,129
    edited 2007-06-01 14:30
    If you need more variables, in most (not all) cases you can use a single element array for a byte variable.

    char VAR BYTE(1)

    SERIN sPin, T9600, char(0)

    What I do is start changing byte variables to byte(1). Then recompile after each change, if the compiler complains, change it back to a normal byte variable.

    It's hard to make any other recommendations because you have never posted your code.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    “The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • stefstef Posts: 173
    edited 2007-06-01 14:43
    Hi

    In attachmend pard off the code. As you can see under variables that are the one I use. I can create no more because then I get the error.

    So for a sx48 with a lot of in and outs it has not much place for varaiables. It depends on the kind of program one want to make but for me it was a simple one and I already run into the limite. I solved some things otherwise so now the program is running fine but I was only curiuse for future project I want to make. I will try what you sugested with the area and go from thier.

    I was wondering if the Propellor has more? Do you know that??

    stef
Sign In or Register to comment.