Framing error if I disable transmitter after shift register is empty?


Results 1 to 40 of 46

Threaded View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154

    Question Framing error if I disable transmitter after shift register is empty?

    TX pin can be set manually, BUT THIS IS ONLY MASKING THE PROBLEM, NOT A REAL SOLUTION.

    See Richard's post #33 and onwards for details.

    Code:
    UsartTX             var LatC.6
    
        UsartTX = 1
        TXSTA.5 = 0
    ------------------------------------------------------

    16F1937

    Gutted my program to try to figure this out.

    Code:
    #CONFIG
     __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF 
     __CONFIG _CONFIG2, _WRT_OFF & _VCAPEN_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_LO & _LVP_OFF
    #ENDCONFIG
    
    DEFINE OSC 32
    SPLLEN          CON %1              ' PLL enable
    IRCF            CON %1110           ' to enable 8 MHz
    SCS             CON %00             ' system clock determined by FOSC
    OSCCON = (SPLLEN << 7) | (IRCF << 3) | SCS
    
    DEFINE  HSER_RCSTA 90h                          ' Enable serial port & continuous receive
    DEFINE  HSER_TXSTA 24h                          ' Enable transmit, BRGH = 1
    Define  HSER_BAUD 115200
    DEFINE  HSER_CLROERR 1                          ' Clear overflow automatically
    DEFINE  HSER_SPBRGH  0
    DEFINE  HSER_SPBRG  68
    BAUDCON.3 = 1                                   ' Enable 16 bit baudrate generator
    
    ANSELA = %00000000
    ANSELB = %00000000
    'ANSELC = %00000000                      ' ...not available
    ANSELD = %00000000
    ANSELE = %00000000
    TRISA = %00000000
    TRISB = %00000000
    TRISC = %00000000
    TRISD = %00000000
    TRISE = %00000000
    BlinkLED                    VAR LatB.5
    
        Pause 500
        hserout ["Hello world", 10]
    
        TXSTA.5 = 1                     ' TXEN: Transmit Enable bit
                    
        hserout ["TEST", 10]                             
    
        while TXSTA.1 = 0               ' Check TRMT: Transmit Shift Register Status bit
        wend
    
        TXSTA.5 = 0                     ' <----- Causes Framing error after last byte !
    
    Mainloop:
        BlinkLED = 1
        BlinkLED = 0
        goto mainloop
    end

    Checking on Logic Probe, the line remains LOW after the last HSEROUT (4K7 pull-up on pin).

    Yet processing is normal if I comment TXSTA.5 = 0.
    Last edited by Demon; - 24th September 2024 at 02:38.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Trying to emulate shift register
    By RuudNL in forum General
    Replies: 0
    Last Post: - 17th March 2013, 19:57
  2. pic+shift register+lcd
    By eworld in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd October 2012, 05:11
  3. Long shift register
    By Joe Rocci in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 18th April 2009, 19:14
  4. Framing Error /w USART
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th February 2007, 01:34
  5. Replies: 15
    Last Post: - 30th January 2005, 03:58

Members who have read this thread : 10

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