Menu

Default TX/RX pin for 16F819 (No UART)

beginer35
2014-01-09
2014-01-21
  • beginer35

    beginer35 - 2014-01-09

    I am trying to run the bootloader on a PIC16F819 with default hex precompiled, but I can do it work on hardware or simulation with proteus .
    I wonder what I'm doing wrong.
    What are the pins used to create the serial communication ?
    According to the asm file :

        #define TXP     1            ; PIC TX Data port (1:A,2:B), Please refer to the table below
        #define TX  4        ; PIC TX Data output pin (i.e. 2=RA2 or RB2, it depends on "PIC TX Data port")
        #define RXP     1            ; PIC RX Data port (1:A,2:B), Please refer to the table below
        #define RX      3            ; PIC RX Data input pin  (i.e. 3=RA3 or RB3, it depends on "PIC RX Data port")
    

    ; #define Direct_TX ; RS-232C TX Direct Connection(No use MAX232)
    ; #define Direct_RX ; RS-232C RX Direct Connection(No use MAX232)
    ; The above 11 lines can be changed and buid a bootloader for the desired frequency (and PIC type)

    I assume that TX is RA4 and RX ​​is RA3. RA5 pin MCLR for reset trying in two modes: driven from DTR and forced to ground too.

    Is this true or am I wrong ?

    I 'm going crazy because I don't understand where I'm failing.

    Sorry for this stupid question,but i'm newbie.

    Thanks in advance.

     

    Last edit: beginer35 2014-01-09
  • Dan

    Dan - 2014-01-09

    hi,beginer35

    Please check the behavior of the following circuits.

     
  • manu

    manu - 2014-01-20

    I'm sorry, that I use this thread, but I can't create an own.

    I have PIC16F1503 without UART. I want to use the bootloader with FT232. But I can't find, which pin is RX and TX on the PIC. I looked in the sourcecode but I'm not sure.

    Maybe someone can help me.
    Thank you in advance.

    With kind regards

    Manu

     
  • Dan

    Dan - 2014-01-21

    Hi,manu

    To modify and recompile the following values.

    p16f1507.inc ----> p16f1503.inc

    [You set]
    TXP 1 ----> 1.or.3
    TX 4 ----> 0.or.1.or.2.or.3.or.4.or.5
    RXP 1 ----> 1.or.3
    RX 5 ----> 0.or.1.or.2.or.3.or.4.or.5

    xtal 8000000 ----> ????????
    [If you change, it is also necessary to change the following lines]
    movlw B'01110000' ;internal clock 8MHz

    baud 9600 ----> ?????????
    [If you change, it is also necessary to change the following lines]
    movlw .256-.24 ; 0.5 us

    [You set]
    __CONFIG


    [Dan_tinybld16F1503-1507_rev4.asm source]

        radix   DEC
    
    ; change these lines accordingly to your application
    

    .#include "p16f1507.inc"
    IdTypePIC = 0x22 ; , Please refer to the table below, must exists in "piccodes.ini"
    .#define max_flash 0x800 ; in WORDS, not bytes!!! (= 'max flash memory' from "piccodes.ini" divided by 2), Please refer to the table below

    xtal EQU 8000000 ; you may also want to change: _HS_OSC _XT_OSC
    baud EQU 9600 ; standard TinyBld baud rates: 115200 or 19200

        #define TXP     1            ; PIC TX Data port (1:A,2:B,3:C), Please refer to the table below
        #define TX  4        ; PIC TX Data output pin (i.e. 2=RA2 or RB2 or RC2, it depends on "PIC TX Data port")
        #define RXP     1            ; PIC RX Data port (1:A,2:B,3:C), Please refer to the table below
        #define RX      5            ; PIC RX Data input pin  (i.e. 3=RA3 or RB3 or RC3, it depends on "PIC RX Data port")
    

    ; #define Direct_TX ; RS-232C TX Direct Connection(No use MAX232)
    ; #define Direct_RX ; RS-232C RX Direct Connection(No use MAX232)
    ; The above 11 lines can be changed and buid a bootloader for the desired frequency (and PIC type)

    ; +---------+--------+------------+-----------+-------+------+
    ; |IdTypePIC| Device | Erase_Page | max_flash | PORT | PDIP |
    ; +---------+--------+------------+-----------+-------+------+
    ; | 0x17 |12F1501 | 16 words | 0x0400 | A | 8 |
    ; | 0x22 |16F1503 | 16 words | 0x0800 | A C | 14 |
    ; | 0x22 |16F1507 | 16 words | 0x0800 | A B C | 20 |
    ; +---------+--------+------------+-----------+-------+------+

    __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _BOREN_OFF & _CLKOUTEN_OFF
    __CONFIG _CONFIG2, _WRT_OFF & _STVREN_OFF & _BORV_LO & _LPBOR_OFF & _LVP_OFF
    
        bsf BSR,0       ;BANK1
        movlw   B'01110000' ;internal clock 8MHz
        movwf   OSCCON
    

    bwait: ; wait 1 bit
    call bwait2 ; 1 us total:1+49+49=99 us
    bwait2: ; wait 1/2bit and Set Carry=1
    movlw .256-.24 ; 0.5 us
    addlw 0x01 ; 0.5 us
    btfss STATUS,Z ; 0.5 us
    bra $-2 ; 1 us
    retlw 0x09 ; 1 us total:0.5+(0.5+0.5+1)*24-0.5+1=49 us

     
  • manu

    manu - 2014-01-21

    Thank you for your answer.
    If I use the default configuration, is RX = RA5 and TX = RA4?
    #define TXP 1
    #define TX 4
    #define RXP 1
    #define RX 5
    Do the bootloader software UART?

    Edit:
    Now I can answer my questions by myself. Yes, the bootloader use software UART. And yes RA5 and RA4 are right.

    But I have an error while opening the application on my Windows 7 laptop. That ist the error message:
    Informationen über das Aufrufen von JIT-Debuggen
    anstelle dieses Dialogfelds finden Sie am Ende dieser Meldung.

    ** Ausnahmetext **
    System.ArgumentOutOfRangeException: InvalidArgument=Value mit dem Wert 0 ist für SelectedIndex ungültig.
    Parametername: SelectedIndex
    bei System.Windows.Forms.ListBox.set_SelectedIndex(Int32 value)
    bei TinyPicBootloader.Form1.Form1_Load(Object sender, EventArgs e)
    bei System.Windows.Forms.Form.OnLoad(EventArgs e)
    bei System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
    bei System.Windows.Forms.Control.CreateControl()
    bei System.Windows.Forms.Control.WmShowWindow(Message& m)
    bei System.Windows.Forms.Control.WndProc(Message& m)
    bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ** Geladene Assemblys **
    mscorlib
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.5472 (Win7SP1GDR.050727-5400).
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll.
    ----------------------------------------
    Tiny_Avr-Pic_Bootloader+
    Assembly-Version: 0.8.3.0.
    Win32-Version: 0.8.3.0.
    CodeBase: file:///C:/Users/manu/Desktop/Tiny_Avr-Pic_Bootloader+%20(v0.8.3)/Tiny_Avr-Pic_Bootloader+.exe.
    ----------------------------------------
    System.Windows.Forms
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400).
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0b77a5c561934e089/System.Windows.Forms.dll.
    ----------------------------------------
    System
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400).
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0
    b77a5c561934e089/System.dll.
    ----------------------------------------
    System.Drawing
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400).
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll.
    ----------------------------------------
    System.Windows.Forms.resources
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.5420 (Win7SP1.050727-5400).
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_de_b77a5c561934e089/System.Windows.Forms.resources.dll.
    ----------------------------------------
    mscorlib.resources
    Assembly-Version: 2.0.0.0.
    Win32-Version: 2.0.50727.5472 (Win7SP1GDR.050727-5400).
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll.
    ----------------------------------------

    ** JIT-Debuggen **
    Um das JIT-Debuggen (Just-In-Time) zu aktivieren, muss in der
    Konfigurationsdatei der Anwendung oder des Computers
    (machine.config) der jitDebugging-Wert im Abschnitt system.windows.forms festgelegt werden.
    Die Anwendung muss mit aktiviertem Debuggen kompiliert werden.

    Zum Beispiel:

    <configuration>
    <system.windows.forms jitDebugging="true"/>
    </configuration>

    Wenn das JIT-Debuggen aktiviert ist, werden alle nicht behandelten
    Ausnahmen an den JIT-Debugger gesendet, der auf dem
    Computer registriert ist, und nicht in diesem Dialogfeld behandelt.

    If I cklick next, everything is fine.

     

    Last edit: manu 2014-01-21

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.