UART Write



  • All,
    Trying to connect a PIC18F processor to FIPY. Fipy and PIC serial being tied together via level logic converter (TXS0108EPWR from Texas Instruments). Fipy receiving data from PIC perfectly, but when I pass the Fipy's date/time data back to PIC, the data is not making sense. Example, sending MM=08,DD=05, YY=19, Hr=14, Min=41 as
    uart1.write('0805191441') returns
    Received b'008600F6000000170000\r'
    or
    Received b'00008600F60000001700\r'
    or, after hex conversion of same:
    uart1.write(b'\x2FFE3F11') returns
    Received b'00008600F60000001700\r'
    on PIC side.

    import machine
    import struct
    import time
    import pycom
    from network import WLAN
    time.sleep(3) # add sleep to allow for TPS softstart
    pycom.heartbeat(True)
    uart1 = UART(1, baudrate=9600)
    uart1.init(9600,bits=8,parity=None, stop=1)
    while True:
        recv=uart1.readall()
        print('Received  %s' %recv)
        snd=hex(0805191441)
        #uart1.write('0805191441')
        uart1.write(b'\x2FFE3F11')
        time.sleep(2)    
             
    

    What am I doing wrong?? Eventually, I would like to pass the MMDDYYHRMIN variable, but at this time even a fixed made up known time is not making sense.
    Thanks


Log in to reply
 

Pycom on Twitter