Today 18:59
Forum: Proton Plus Compiler v3
Starter: teo
Views: 0
Replies: 2
Today 17:48
Forum: Proton Plus Compiler v3
Starter: mjturner
Views: 0
Replies: 2
Today 16:17
Forum: Proton Studio
Starter: johngb
Views: 0
Replies: 0
Go to last post By: towlerg
Today 13:37
Forum: The Lounge
Starter: towlerg
Views: 0
Replies: 0
+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,521
    Thumbs Up
    Received: 57
    Given: 86
    Total Downloaded
    895.24 MB

    0 Not allowed!

    Default Has anyone code to set up a firewing board 18f... to talk via the USART/USB?

    Hi As per title I have a firewing board 18F and want make it talk via the built in USART/USB device to a terminal.

    I can program its via a Pickit2

    I'm having issues. Has anyone a bit of code with the fuse settings etc to make it work?

    Thanks

    Tim
    Tim

  2. #2
    Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    360
    Thumbs Up
    Received: 64
    Given: 0
    Total Downloaded
    106.96 MB

    0 Not allowed!

    Default Re: Has anyone code to set up a firewing board 18f... to talk via the USART/USB?

    The interface between the main 18F and the USB uC (18F14K50) is pretty much just a uart setup for 38400.

    One think to note... if you're using the stock firmware in the 14K50 it uses the terminal DTR function to control the MCLR reset to the main uC.
    Check out http://www.firewing.info/forum/viewtopic.php?f=6&t=21 for how that works.

  3. #3
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,521
    Thumbs Up
    Received: 57
    Given: 86
    Total Downloaded
    895.24 MB

    0 Not allowed!

    Default Re: Has anyone code to set up a firewing board 18f... to talk via the USART/USB?

    Thanks

    Do you have any sample code showing it working that I can program not using the bootloader. Eg the icsp

    Thanks

    Tim
    Tim

  4. #4
    Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    360
    Thumbs Up
    Received: 64
    Given: 0
    Total Downloaded
    106.96 MB

    0 Not allowed!

    Default Re: Has anyone code to set up a firewing board 18f... to talk via the USART/USB?

    Sorry, Tim. Not in Proton.

    I probably have some Swordfish code for a K22 floating around somewhere if that would be of any help...

  5. #5
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,521
    Thumbs Up
    Received: 57
    Given: 86
    Total Downloaded
    895.24 MB

    0 Not allowed!

    Default Re: Has anyone code to set up a firewing board 18f... to talk via the USART/USB?

    Hi

    I have a firewing dongle somewhere. I need the fuse setup etc

    Thanks

    Tim
    Tim

  6. #6
    Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    360
    Thumbs Up
    Received: 64
    Given: 0
    Total Downloaded
    106.96 MB

    0 Not allowed!

    Default Re: Has anyone code to set up a firewing board 18f... to talk via the USART/USB?

    These are the settings from an old Swordfish program running on the firewing board
    Code:
    device = 18F26K22
    clock = 64
    
    config
        // CONFIG1H
        FOSC = INTIO7,      // (FOSC) = [LP, XT, HSHP, HSMP, ECHP, ECHPIO6, RC, RCIO6, INTIO67, INTIO7, ECMP, ECMPIO6, ECLP, ECLPIO6],
        PLLCFG = OFF,       // (PLLCFG) = [OFF, ON],
        PRICLKEN = OFF,     // (PRICLKEN) = [OFF, ON],
        FCMEN = OFF,        // (FCMEN) = [OFF, ON],
        IESO = OFF,         // (IESO) = [OFF, ON],
        // CONFIG2L
        PWRTEN = OFF,       // (PWRTEN) = [ON, OFF],
        BOREN = OFF,        // (BOREN) = [OFF, ON, NOSLP, SBORDIS],
        BORV = 285,         // (BORV) = [285, 250, 220, 190],
        // CONFIG2H
        WDTEN = OFF,        // (WDTEN) = [OFF, NOSLP, SWON, ON],
        WDTPS = 2048,       // (WDTPS) = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768],
        // CONFIG3H
        CCP2MX = PORTB3,    // (CCP2MX) = [PORTB3, PORTC1],
        PBADEN = OFF,       // (PBADEN) = [OFF, ON],
        CCP3MX = PORTB5,    // (CCP3MX) = [PORTC6, PORTB5],
        HFOFST = OFF,       // (HFOFST) = [OFF, ON],
        T3CMX = PORTC0,     // (T3CMX) = [PORTB5, PORTC0],
        P2BMX = PORTC0,     // (P2BMX) = [PORTC0, PORTB5],
        MCLRE = EXTMCLR,    // (MCLRE) = [INTMCLR, EXTMCLR],
        // CONFIG4L
        STVREN = OFF,       // (STVREN) = [OFF, ON],
        LVP = OFF,          // (LVP) = [OFF, ON],
        XINST = OFF         // (XINST) = [OFF, ON],
    
    // 64MHz int osc
    OSCCON = $70            // primary osc, 16MHz int osc
    OSCTUNE.bits(6) = 1     // PLL enabled (x4)
    
    // uart1 PORTC.6 and 7 digital IO, normal slewrate
    ANSELC = 0
    SLRC = 0
    
    // set uart1 baudrate = 38400
    If you need anything else, let me know.

  7. #7
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,521
    Thumbs Up
    Received: 57
    Given: 86
    Total Downloaded
    895.24 MB

    0 Not allowed!

    Default Re: Has anyone code to set up a firewing board 18f... to talk via the USART/USB?

    Thanks

    After using fuse config I got it to work in a sim. Not yet on the board, I think it's a timing issue. But getting nearer..

    Cheers
    Tim

  8. #8
    Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    360
    Thumbs Up
    Received: 64
    Given: 0
    Total Downloaded
    106.96 MB

    0 Not allowed!

    Default Re: Has anyone code to set up a firewing board 18f... to talk via the USART/USB?

    Here's a little echo program that I just ran on the FW18 board programmed via the icsp (PK3)
    Code:
    Device = 18F26K22
    Declare Xtal = 64
    
    Config_Start
        ; CONFIG1H
        FOSC = INTIO7      ; (FOSC) = [LP, XT, HSHP, HSMP, ECHP, ECHPIO6, RC, RCIO6, INTIO67, INTIO7, ECMP, ECMPIO6, ECLP, ECLPIO6],
        PLLCFG = OFF       ; (PLLCFG) = [OFF, ON],
        PRICLKEN = OFF     ; (PRICLKEN) = [OFF, ON],
        FCMEN = OFF        ; (FCMEN) = [OFF, ON],
        IESO = OFF         ; (IESO) = [OFF, ON],
        ; CONFIG2L
        PWRTEN = OFF       ; (PWRTEN) = [ON, OFF],
        BOREN = OFF        ; (BOREN) = [OFF, ON, NOSLP, SBORDIS],
        BORV = 285         ; (BORV) = [285, 250, 220, 190],
        ; CONFIG2H
        WDTEN = OFF        ; (WDTEN) = [OFF, NOSLP, SWON, ON],
        WDTPS = 2048       ; (WDTPS) = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768],
        ; CONFIG3H
        CCP2MX = PORTB3    ; (CCP2MX) = [PORTB3, PORTC1],
        PBADEN = OFF       ; (PBADEN) = [OFF, ON],
        CCP3MX = PORTB5    ; (CCP3MX) = [PORTC6, PORTB5],
        HFOFST = OFF       ; (HFOFST) = [OFF, ON],
        T3CMX = PORTC0     ; (T3CMX) = [PORTB5, PORTC0],
        P2BMX = PORTC0     ; (P2BMX) = [PORTC0, PORTB5],
        MCLRE = EXTMCLR    ; (MCLRE) = [INTMCLR, EXTMCLR],
        ; CONFIG4L
        STVREN = OFF       ; (STVREN) = [OFF, ON],
        LVP = OFF          ; (LVP) = [OFF, ON],
        XINST = OFF        ; (XINST) = [OFF, ON],
        Debug = OFF        ; (DEBUG) = [ON, OFF],
        ; CONFIG5L
        Cp0 = OFF          ; (CP0) = [ON, OFF],
        CP1 = OFF          ; (CP1) = [ON, OFF],
        CP2 = OFF          ; (CP2) = [ON, OFF],
        CP3 = OFF          ; (CP3) = [ON, OFF],
        ; CONFIG5H
        CPB = OFF          ; (CPB) = [ON, OFF],
        CPD = OFF          ; (CPD) = [ON, OFF],
        ; CONFIG6L
        WRT0 = OFF         ; (WRT0) = [ON, OFF],
        WRT1 = OFF         ; (WRT1) = [ON, OFF],
        WRT2 = OFF         ; (WRT2) = [ON, OFF],
        WRT3 = OFF         ; (WRT3) = [ON, OFF],
        ; CONFIG6H
        WRTC = OFF         ; (WRTC) = [ON, OFF],
        WRTB = OFF         ; (WRTB) = [ON, OFF],
        WRTD = OFF         ; (WRTD) = [ON, OFF],
        ; CONFIG7L
        EBTR0 = OFF        ; (EBTR0) = [ON, OFF],
        EBTR1 = OFF        ; (EBTR1) = [ON, OFF],
        EBTR2 = OFF        ; (EBTR2) = [ON, OFF],
        EBTR3 = OFF        ; (EBTR3) = [ON, OFF],
        ; CONFIG7H
        EBTRB = OFF         ; (EBTRB) = [ON, OFF]
    Config_End
    
    Declare Hserial_Baud = 38400
    Declare Hserial_TXSTA = 0x24
    Declare Hserial_Clear = On   ' Clear the buffer before receiving
    
    Dim b As Byte
    
    ' set intosc for 64MHz, 4xpll
    OSCCON = 0x70
    OSCTUNE.6 = 1
    
    ' portc digital IO, normal slewrate
    ANSELC = 0
    SLRCON.2 = 0    ; SLRC
    
    DelayMS 10
    
    ' read chars and echo
    Do
        HSerIn [b]
        HSerOut [b]
    Loop

  9. #9
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,521
    Thumbs Up
    Received: 57
    Given: 86
    Total Downloaded
    895.24 MB

    0 Not allowed!

    Default Re: Has anyone code to set up a firewing board 18f... to talk via the USART/USB?



    Thanks, works now!
    Tim

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Conversion of I2C code from Firewing to Proton
    By Tim in forum Proton Plus Compiler v3
    Replies: 0
    Last Post: 12th July 2018, 16:05
  2. PIC18F4550 USB USART example code in the proton
    By dnaci in forum Projects discussion
    Replies: 1
    Last Post: 26th January 2012, 00:10
  3. 18f instruction set document?
    By BenH in forum The Lounge
    Replies: 4
    Last Post: 3rd March 2008, 22:11
  4. Can I set the brown out reset voltage from within the code
    By jonnykyoto in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 8th November 2006, 12:01
  5. 18F vs 16F code size & Optimizer question...
    By cgriffin in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 31st October 2006, 07:04

Members who have read this thread : 35

Actions :  (Set Date)

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