Conflict receiving RS485 stream


Closed Thread
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    GREECE
    Posts
    120

    Default Conflict receiving RS485 stream

    Hello Boys&Girls,

    I hope you are well.It is time for holidays not for work but...money!!!

    Let's talk about PicBasic Pro.
    I have a problem with my code.I have a 16F628A which receives a rs485 stream.The device that transmit the stream is the master and it can <<talk>> with 128 slave devices.My pic is a slave device so it has a header(an address).
    When I don't receive the stream my code loop MAIN it is working propertly.
    When I receive my pic reads ok the stream but I can not go to MENU label while the conditions of porta.3 &porta.4 is 1.

    Here is my code:

    --------------------------------------------------------------------------
    MAIN: IF PORTB.6 = 1 THEN STATIC
    WHILE PORTA.3 = 1 AND PORTA.4 = 1 <--it does not work when I it receives
    GOTO MENU
    wend
    DYNAMIC: IF RCIF = 1 THEN
    HSERIN 300,MAIN,[WAIT(X),STR SERDATA\17] ;X = header - address
    GOSUB OUT
    gosub SERTALLY
    ENDIF
    GOTO MAIN
    --------------------------------------------------------------------------

    Thanks
    Nikos Geronikolos

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ngeronikolos
    Code:
    -----------------------------------------------------------------MAIN:    IF PORTB.6 = 1 THEN STATIC    
      WHILE PORTA.3 = 1 AND PORTA.4 = 1 <--it does not work when I it receives
      GOTO MENU
      wend      
    DYNAMIC: IF RCIF = 1 THEN 
       HSERIN 300,MAIN,[WAIT(X),STR SERDATA\17] ;X = header - address     
       GOSUB OUT
       gosub SERTALLY
       ENDIF
       GOTO MAIN
    -----------------------------------------------------------------
    what do MENU, OUT and SERTALLY do?

    and...
    you are using a While...Wend loop that is jumped out of as soon as the condition in the While statement is met.

    That doesn't make much sense, better would be something like:
    Code:
    IF PORTA.3 = 1 AND PORTA.4 = 1 THEN  GOTO MENU
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



Similar Threads

  1. RS485 splitter
    By The Master in forum Off Topic
    Replies: 0
    Last Post: - 30th August 2009, 06:04
  2. USB to RS485
    By The Master in forum USB
    Replies: 0
    Last Post: - 3rd January 2009, 03:49
  3. Using 16f676 with comms
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 28th October 2005, 20:01
  4. USB Receiving a Word
    By sean-h in forum USB
    Replies: 2
    Last Post: - 9th October 2005, 16:56
  5. How can I read an RS485 stream?
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th July 2005, 14:26

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts