Hot!Posting tool

Author
BumpSplat
Senior Member
  • Total Posts : 144
  • Reward points : 0
  • Joined: 2017/11/06 13:23:11
  • Location: Bend, OR
  • Status: offline
2018/05/23 17:54:06 (permalink)
0

Posting tool

Here's an easy one!  I've been using this forum and would like to make better looking posts.  I've been seeing great code examples with text.  Can anyone suggest a tool for inserting a good looking code format?  I'd like free if possible.
 
Thanks!
 
Tim
#1

5 Replies Related Threads

    qɥb
    Monolothic Member
    • Total Posts : 3329
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: Posting tool 2018/05/23 17:57:26 (permalink)
    0
    Can you link to an example of what you mean?
    Normally, you just put code tags around code pasted from your editor. You just have to ensure you are using spaces rather than tabs for indenting and it should work.
     
    (* "should" in the event the forum is not suffering from one of its many brain fades...)
     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #2
    BumpSplat
    Senior Member
    • Total Posts : 144
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: Posting tool 2018/08/05 11:15:57 (permalink)
    0
    Here's a quick example.  I've seen some really nice posting using others but, I just want to post code with some style in place of non color bulk text as a result of a standard paste:
     
    https://www.microchip.com/forums/m53856.aspx
     
    #3
    PStechPaul
    Super Member
    • Total Posts : 2042
    • Reward points : 0
    • Joined: 2006/06/27 16:11:32
    • Location: Cockeysville, MD, USA
    • Status: offline
    Re: Posting tool 2018/08/05 11:59:41 (permalink)
    +1 (1)
    Here is a short C file that I opened in Notepad and copy/pasted here:
    /*
     * File:   main.c
     * Author: paul_000
     *
     * Created on July 20, 2017, 7:39 PM
     */


    #include <xc.h>
    #include <stdint.h> //needed for uint8_t
    #include "mcc_generated_files/mcc.h"

    #define MAXSINE 20
    #define XTAL_FREQ  16000000
    #define SAMPLE_DELAY    16
    // Sine Table based on 8 bit DAC, 20 elements 18 deg/point
    const uint8_t sintable[] = {167, 203, 231, 250, 255, 250, 231, 203, 167, 128, 88, 53, 25, 6, 1, 6, 25, 53, 88, 128};

    void main(void) {
        SYSTEM_Initialize();
        int i,j;
        while(1) {
            for( j=0; j<5; j++) {
                DACCON1 = 167; _delay(SAMPLE_DELAY);
                DACCON1 = 203; _delay(SAMPLE_DELAY);
                DACCON1 = 231; _delay(SAMPLE_DELAY);
                DACCON1 = 250; _delay(SAMPLE_DELAY);
                DACCON1 = 255; _delay(SAMPLE_DELAY);
                DACCON1 = 250; _delay(SAMPLE_DELAY);
                DACCON1 = 231; _delay(SAMPLE_DELAY);
                DACCON1 = 203; _delay(SAMPLE_DELAY);
                DACCON1 = 167; _delay(SAMPLE_DELAY);
                DACCON1 = 128; _delay(SAMPLE_DELAY);
                DACCON1 = 88; _delay(SAMPLE_DELAY);
                DACCON1 = 53; _delay(SAMPLE_DELAY);
                DACCON1 = 25; _delay(SAMPLE_DELAY);
                DACCON1 = 6; _delay(SAMPLE_DELAY);
                DACCON1 = 1; _delay(SAMPLE_DELAY);
                DACCON1 = 6; _delay(SAMPLE_DELAY);
                DACCON1 = 25; _delay(SAMPLE_DELAY);
                DACCON1 = 53; _delay(SAMPLE_DELAY);
                DACCON1 = 88; _delay(SAMPLE_DELAY);
                DACCON1 = 128; _delay(SAMPLE_DELAY-9);
                
    //            for( i=0; i<MAXSINE; i++) {
    //                DACCON1  = sintable[i];
                          //     DAC1_SetOutput(sintable[i]);
    //                __delay_us(1);
    //            }
            }
            __delay_ms(1);
            LATAbits.LATA0 = !PORTAbits.RA0;
        }
    }

    You can use "Courier New" font (monospace) for a different "look", but code tags use their own font:
    /*
     * File:   main.c
     * Author: paul_000
     *
     * Created on July 20, 2017, 7:39 PM
     */

    #include <xc.h>
    #include <stdint.h> //needed for uint8_t
    #include "mcc_generated_files/mcc.h"

    #define MAXSINE 20
    #define XTAL_FREQ  16000000
    #define SAMPLE_DELAY    16
    // Sine Table based on 8 bit DAC, 20 elements 18 deg/point
    const uint8_t sintable[] = {167, 203, 231, 250, 255, 250, 231, 203, 167, 128, 88, 53, 25, 6, 1, 6, 25, 53, 88, 128};

    void main(void) {
        SYSTEM_Initialize();
        int i,j;
        while(1) {
            for( j=0; j<5; j++) {
                DACCON1 = 167; _delay(SAMPLE_DELAY);
                DACCON1 = 203; _delay(SAMPLE_DELAY);
                DACCON1 = 231; _delay(SAMPLE_DELAY);
                DACCON1 = 250; _delay(SAMPLE_DELAY);
                DACCON1 = 255; _delay(SAMPLE_DELAY);
                DACCON1 = 250; _delay(SAMPLE_DELAY);
                DACCON1 = 231; _delay(SAMPLE_DELAY);
                DACCON1 = 203; _delay(SAMPLE_DELAY);
                DACCON1 = 167; _delay(SAMPLE_DELAY);
                DACCON1 = 128; _delay(SAMPLE_DELAY);
                DACCON1 = 88; _delay(SAMPLE_DELAY);
                DACCON1 = 53; _delay(SAMPLE_DELAY);
                DACCON1 = 25; _delay(SAMPLE_DELAY);
                DACCON1 = 6; _delay(SAMPLE_DELAY);
                DACCON1 = 1; _delay(SAMPLE_DELAY);
                DACCON1 = 6; _delay(SAMPLE_DELAY);
                DACCON1 = 25; _delay(SAMPLE_DELAY);
                DACCON1 = 53; _delay(SAMPLE_DELAY);
                DACCON1 = 88; _delay(SAMPLE_DELAY);
                DACCON1 = 128; _delay(SAMPLE_DELAY-9);
                
    //            for( i=0; i<MAXSINE; i++) {
    //                DACCON1  = sintable;
                          //     DAC1_SetOutput(sintable);
    //                __delay_us(1);
    //            }
            }
            __delay_ms(1);
            LATAbits.LATA0 = !PORTAbits.RA0;
        }
    }
    post edited by PStechPaul - 2018/08/05 12:02:19

     
    #4
    katela
    Super Member
    • Total Posts : 954
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: Posting tool 2018/08/05 19:26:35 (permalink)
    +1 (1)
    Just use the code tags and you should be OK.
     

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/user/StudentCompanionSA
    #5
    qɥb
    Monolothic Member
    • Total Posts : 3329
    • Reward points : 0
    • Joined: 2017/09/09 05:07:30
    • Location: Jupiter
    • Status: offline
    Re: Posting tool 2018/08/05 20:27:24 (permalink)
    +3 (3)
    katela
    Just use the code tags and you should be OK.

    So long as you use spaces for indenting, not tabs.


     

    This forum is mis-configured so it only works correctly if you access it via https protocol.
    The Microchip website links to it using http protocol. Will they ever catch on?
    PicForum "it just works"
    #6
    Jump to:
    © 2018 APG vNext Commercial Version 4.5