MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Dec 2005
    Posts
    1,073

    Default Re: MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?

    If mikrobasic allows, you might try increasing the time between bytes.

  2. #2
    Join Date
    Jun 2011
    Posts
    24

    Default Re: MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?

    Ok we made some progress. I added a 500us pause between bytes and its getting the values now.
    But now only the first chip is getting the serial. The 3 slave chips are on seperate lines. The first chip is getting values but the second 2 aren't getting any. My transmit code is below

    Code:
    sub procedure Send()
        porta.0 = 1
        
        portc.2 = 1
        error1 = Soft_UART_Init(PORTC,1, 5, 9600, 0)
        delay_ms(3)
        soft_uart_write("@")
        for i = 0 to 5
            soft_uart_write(Coxa[i])
            delay_us(500)
        next i
        portc.2 = 0
        
        portc.1 = 1
        error1 = Soft_UART_Init(PORTC,2, 4, 9600, 0)
        delay_ms(3)
        soft_uart_write("@")
        for i = 0 to 5
            soft_uart_write(Thigh[i])
            delay_us(500)
        next i
        portc.1 = 0
        portc.0 = 1
        error1 = Soft_UART_Init(PORTC,0, 3, 9600, 0)
        delay_ms(3)
        soft_uart_write("@")
        for i = 0 to 5
            soft_uart_write(Tibia[i])
            delay_us(500)
        next i
        portc.0 = 0
        
        porta.0 = 0
        return
    end sub

    my receiver waits for the @ symbol so that is why its sent first.

  3. #3
    Join Date
    Jun 2011
    Posts
    24

    Default Re: MIKROBASIC Soft_Uart to PICBASIC SEIRIN2?

    Ok I found several errors in the last one I posted so here is the newest code revision

    Code:
    sub procedure Send()
        porta.0 = 1
        
        portc.2 = 1
        error1 = Soft_UART_Init(PORTC,0, 5, 9600, 0)
        delay_ms(3)
        soft_uart_write("@")
        for i = 0 to 5
            delay_us(300)
            soft_uart_write(Coxa[i])
        next i
        portc.2 = 0
        
        portc.1 = 1
        error1 = Soft_UART_Init(PORTC,2, 4, 9600, 0)
        delay_ms(3)
        soft_uart_write("@")
        for i = 0 to 5
            delay_us(300)
            soft_uart_write(Thigh[i])
        next i
        portc.1 = 0
        portc.0 = 1
        error1 = Soft_UART_Init(PORTC,1, 3, 9600, 0)
        delay_ms(3)
        soft_uart_write("@")
        for i = 0 to 5
               delay_us(300)
            soft_uart_write(Tibia[i])
        next i
        portc.0 = 0
        
        porta.0 = 0
        return
    end sub

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