Shop OBEX P1 Docs P2 Docs Learn Events
Sx Source Boost Interrupt and Seial out — Parallax Forums

Sx Source Boost Interrupt and Seial out

KiwiKiwi Posts: 85
edited 2005-11-30 15:06 in General Discussion
Hello,

i have found in a example a routine that is used for blonking a led with the use of a interrupt routine.
I am also using serial routine for sending message to a serial LCD display.

But why can't i use the both routine together. if i do so, the text that is diplayed (send to) the LCD is not correct.

Is it possible that the reason is the following. The interrupt routine cause the delaying for sending the message to be incorrect??

How can i know what is the correct value+divider for interrupt routines?? I read something stay above 99 and below 255.

Can somebody help me out

just activated the following line set_option, and you will see the result

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-29 14:36
    You'll need to chat with your compiler vendor -- what I think he'll tell you is to suspend interrupts when you want to transmit serial data. When the ISR interrupts in the middle of a serial transmission the transmission gets corrupted. What you will probably want to do -- though this is a little more complicated -- is setup a "virtual peripheral" UART that's part of the ISR so that you can send data at the same time as blinking the light.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • KiwiKiwi Posts: 85
    edited 2005-11-30 14:14
    Yes it was a duplicate, sorry for that.

    And what if, lets say, i am will use sx/b to write the program in. Same problem if using serout and interrupt routines? Because serout will also use some delay routines, i supose?

    Are there more exaples of using the pink together with sx, i am really interested in the pink module, and want to figure out everything before buying.


    Kurt
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-30 14:18
    No matter what processor you use, interrupts will have an effect on timing sensitive instructions like SERIN/SEROUT. If one is a clever code writer -- like our pal, Bean -- you can construct the ISR such that it always runs the same number of cycles and therefore allows the SERIN/SEROUT to be compensated for those "borrowed" cycles. In the projects section Bean posted a PWM driver that uses a compensated SERIN instruction to deal with the interrupt timing.

    The PINK module is very new, and so far I'm not aware of any SX applications using it. That said, with SX/B one could probably port the BASIC Stamp code without too much difficulty.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • BeanBean Posts: 8,129
    edited 2005-11-30 15:06
    Kurt, for minimum effect on SEROUT the interrupt should be as short as possible, take EXACTLY the same number of cycles no matter what it's doing, and be called at least several times during each serial bit period.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Those that would give up freedom for security will have neither.
    ·
Sign In or Register to comment.