Master to slave 16F767


Results 1 to 7 of 7

Threaded View

  1. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    There's a potential stack overflow here
    Code:
    loop:
    RSIn Wait("SLAVE"), value
    If value = 0 Then
    GoTo loop
    Else
    GoSub charin ' Get a character from serial input, if any
    EndIf
    
    charin:
    There's no return in your code to handle it, the only one you have do the PWM, so if the value <>0, yes it will perform the Charin procedure... but you never POP the stack, after 2-3 time, yes indeed, your program may behave in a weird way. Try this...
    Code:
    loop:
    RSIn Wait("SLAVE"), value
    If value = 0 Then GoTo loop
    
    charin:
    Also, you want to make sure that your Serial dataline is noise free and idle at the right level if both device are disconnected.
    Last edited by mister_e; - 30th May 2008 at 18:24.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Another I2C Slave Routine Problem
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th February 2009, 06:50
  2. I2C Master Slave issues.
    By cpayne in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 29th March 2008, 20:33
  3. PIC master slave howto
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th September 2007, 23:35
  4. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 23:59
  5. Replies: 2
    Last Post: - 10th June 2005, 03:34

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