How to post Code


+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2005
    Posts
    24

    Default How to post Code

    Quick question, how do I post code within the window on the forum, I have looked on the the site, but I can't find it, I am sure it is very simple to do.

    Thanks,
    Terry

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default Re: How to post Code

    At the bottom of each thread, there is a "Posting Permissions" box.
    In there you'll see a "BB code" link.

    That page shows all the different things you can do in a post on the forum.
    The one you want is "Code".

    HTH,
    DT

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default Re: How to post Code

    Once you click on the reply button you will want to click on the Go Advanced button.
    Then you should see a tool bar above the editor box. The "#" will give you the code tags.
    You will also want to click the upper left button of the tool bar to go into source mode, it works better than WYSIWYG.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,256

    Cool Re: How to post Code

    Good place to see if my code posts properly. I've seen some have problems with %.

    Code:
    '****************************************************************
    '*  Name    : LAB X1 16F877 Timer Interrupt.BAS                 *
    '*  Author  : Demon                                      *
    '*  Notice  : Copyright (c) 2012                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 2012-01-06                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : PIC Basic Pro v2.60C                              *
    '*          : MicroCode Studio Plus v2.2.1.1                    *
    '*          : MPASM v3.50                                       *
    '*          : Lab X1 Experimental Board                         *
    '*          : MeLabs U2 Programmer v4.32                        *
    '****************************************************************
    'define  LOADER_USED 1
    
    ' Comment out CONFIG in MPASM include (File: 16F877.INC in PBP folder).
    @ __config _HS_OSC & _WDT_OFF & _PWRTE_ON & _BODEN_ON & _LVP_OFF & _CPD_OFF & _WRT_ENABLE_OFF & _DEBUG_OFF & _PWRTE_OFF
    
    define  OSC 20
    
    DEFINE  LCD_DREG      PORTD         ' Set LCD data port
    DEFINE  LCD_DBIT      0             ' Set starting data bit
    DEFINE  LCD_RSREG     PORTE         ' Set LCD register select port
    DEFINE  LCD_RSBIT     0             ' Set LCD register select bit
    DEFINE  LCD_EREG      PORTE         ' Set LCD enable port
    DEFINE  LCD_EBIT      1             ' Set LCD enable bit
    DEFINE  LCD_BITS      8             ' Set LCD bus size
    DEFINE  LCD_LINES     2             ' Set number of lines on LCD
    define  LCD_COMMANDUS 2000          ' Set command delay time in microseconds
    DEFINE  LCD_DATAUS    50            ' Set data delay time in microseconds
    
        TRISD = %00000000               ' Set all port D pins to output
        TRISE = %00000000               ' Set all port E pins to output
    
        ADCON1 = 7                      ' A/D off, all digital
    
    wsave   VAR BYTE    $70 SYSTEM      ' Required by Instant Interrupt routine
    
        PAUSE   1000                    ' Wait for LCD to initalize
        LCDOUT  $FE,1,"LabX1 16F877 Tim Int"
    
    '---[INT - interrupt includes]--------------------------------------------------
    INCLUDE "DT_INTS-14.bas"     ; Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ; Include if using PBP interrupts
    INCLUDE "Elapsed_INT.bas"     ; Elapsed Time interrupts
    
    '---[INT - interrupt definition]------------------------------------------------
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   TMR1_INT,  _ClockCount,   PBP,  yes
        endm
        INT_CREATE            ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE  TMR1_INT  ; Enable Timer 1 Interrupts  
    
        GOSUB ResetTime           ' Reset Time to  0d-00:00:00.00
        GOSUB StartTimer          ' Start the Elapsed Timer
    
    Main:
        IF SecondsChanged = 1 THEN  
            SecondsChanged = 0
            LCDOUT $FE,$C0, DEC Days,"d-",DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds
        ENDIF
        GOTO Main
    
        end
    WOOT! It worked!

    Robert
    Last edited by Demon; - 4th October 2016 at 16:20.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts