+ Reply to Thread
Page 1 of 2
1 2 Last
Results 1 to 15 of 16

Thread: Junebug users - fun little diag program for ya

  1. #1
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default Junebug users - fun little diag program for ya

    Technological Arts always used to pre-program their Motorola boards with simple little test programs. That way, when you unpacked it and hooked it up it would be able to do something right away.

    So I started writing one for the Junebug 18F1320. It's simple polled RS232 at present and doesn't test absolutely everything on the board yet, as I don't have some components installed yet. I expect to have my trimpots this week, and I think I have one of those IR sensors somewhere in a junkbox. When those parts are installed I'll finish the program, as well as make it more interrupt-driven (not that it really matters in this program, but it's a nicer way to do it).

    Download the program and source.

    Here's a pic of the RS232 hookup. That's a Techno Arts RS232 ComStamp doing the level shifting on the breadboard. Of course any level shifter will do. HVW Technologies. Sparkfun Electronics. Acroname.

    The display to the right on the breadboard and all the parts to the left are not connected at present. They're just leftovers from a previous project.
    Junebug users - fun little diag program for ya-junebug-002_wb_sm.jpg
    Here it is with code slightly modified for display on a BG Micro ACS1385 vacuum flourescent display
    Junebug users - fun little diag program for ya-junebug008_wb_sm.jpg
    Oh ya! It runs at 9600 baud, 8N1 for now, so set up your terminal accordingly.
    Last edited by futz; 20th November 2007 at 05:52 AM.


  2. #2
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,709
    Blog Entries
    5

    Default

    Very nice work.
    PICkit has a nifty terminal program, catch is you can't use it and the ICD at the same time.
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  3. #3
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Bump. New photo added.

  4. #4
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,709
    Blog Entries
    5

    Default

    Looks like someones having fun

    Here's something you might like...

    Convert ASCII to upper case (untested)
    Code:
    ;* main - poll rs232 for menu commands and branch accordingly
    loop    call    rs_recv            ;wait for a char
        andlw    b'00111111'        ; convert to upper case
        movwf    char            ;save the char for later
    
    The 18F compare and skip command
    Code:
    cont07  movlw   "0"
        cpfseq   char            ;is it '0'?                   
        goto     cont08        ;no, continue
    
    Last edited by blueroomelectronics; 19th November 2007 at 02:38 PM.
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  5. #5
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by blueroomelectronics
    Looks like someones having fun
    Oh ya.

    Convert ASCII to upper case (untested)
    Code:
    ;* main - poll rs232 for menu commands and branch accordingly
    loop    call    rs_recv            ;wait for a char
        andlw    b'00111111'        ; convert to upper case
        movwf    char            ;save the char for later
    
    Well duh! I should have thought of that. Just do it once. Most of that menu code is from a few years back when I did this on a 16f628. Time to clean it up.

    The 18F compare and skip command
    Good. Saves another line.

  6. #6
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,709
    Blog Entries
    5

    Default

    And another line saved
    setf ADCON1 ; all digital
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  7. #7
    Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent
    Join Date
    Jan 2005
    Location
    Michigan, USA
    Posts
    2,522

    Default

    Is someone having fun discovering some of the neat 16-bit core instructions for the first time?

  8. #8
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,709
    Blog Entries
    5

    Default

    I know I am. I've been using the 16F for years.
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  9. #9
    Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent
    Join Date
    Jan 2005
    Location
    Michigan, USA
    Posts
    2,522

    Default

    Well, here's a 2 page (8.5x11) PIC 18F' Instruction Set Summary 'pdf' file I created several years ago, if you're interested.

    I found it handy to pin the sheets onto the cork board directly in front of my desk when I was starting out with the 18F' devices.

    I also have a 1 page 11x17 version if you or anyone would like it...

    Have fun, Mike
    Attached Files

  10. #10
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,709
    Blog Entries
    5

    Default

    Here's a Edit *NOT* working ASCII upper case converter from this site, might work for 16F chips http://www.retards.org/library/techn...rc/snippet.htm
    Code:
    ;* main - poll rs232 for menu commands and branch accordingly
    loop    call    rs_recv        ; wait for a char
    UpCase  addlw   255 - "z"     ; Get the High limit
           addlw   "z" - "a" + 1     ; Add Lower Limit to Set Carry
        btfss   STATUS, C      ; If Carry Set, then Lower Case
           addlw   h'20'           ; Carry NOT Set, Restore Character
          addlw   "A"        ; add 'A' to restore the Character
        movwf    char        ; save the char for later
    
    Last edited by blueroomelectronics; 19th November 2007 at 11:54 PM.
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  11. #11
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by blueroomelectronics
    Convert ASCII to upper case (untested)
    Code:
    ;* main - poll rs232 for menu commands and branch accordingly
    loop    call    rs_recv            ;wait for a char
        andlw    b'00111111'        ; convert to upper case
        movwf    char            ;save the char for later
    
    Almost correct (you did say "untested"). You actually have to clear bit5 to capitalize, not bit6.

    But that kills numbers, so you have to add another line to keep them intact, like this
    Code:
    loop	call	rs_recv			;wait for a char
    	movwf	numr			;save as numeral
    	andlw	b'01011111'		;convert to upper case
    	movwf	char			;save as uppercase char
    
    and then test letters against char and numbers against numr. Or you could do a test at the start and only clear bit 5 on letters.

    The download has been updated.
    Last edited by futz; 20th November 2007 at 05:50 AM.

  12. #12
    Help us help you blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent blueroomelectronics Excellent
    Join Date
    Jan 2007
    Location
    Toronto, Canada
    Posts
    10,709
    Blog Entries
    5

    Default

    This appears to work
    Code:
        movwf    char        ; save the char for later
        sublw   "a" -1          ;
        btfss   STATUS, C       ;
        bcf     char, 5            ; convert a-z to upper case
    
    Bill
    Smart Kits build Smart People

    http://www.blueroomelectronics.com/

  13. #13
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Interrupt receive version posted to same rar. This version runs at 57600 - 8/N/1. Just download from the same link as before. Both versions are in the rar. The file for this version is 'int_diag'.

  14. #14
    wmmullaney Good wmmullaney Good wmmullaney Good
    Join Date
    Dec 2006
    Location
    USA
    Posts
    368

    Default

    Quote Originally Posted by Mike, K8LH
    Well, here's a 2 page (8.5x11) PIC 18F' Instruction Set Summary 'pdf' file I created several years ago, if you're interested.

    I found it handy to pin the sheets onto the cork board directly in front of my desk when I was starting out with the 18F' devices.

    I also have a 1 page 11x17 version if you or anyone would like it...

    Have fun, Mike
    Have one for the 16f series?

  15. #15
    wmmullaney Good wmmullaney Good wmmullaney Good
    Join Date
    Dec 2006
    Location
    USA
    Posts
    368

    Default

    Quote Originally Posted by Mike, K8LH
    Well, here's a 2 page (8.5x11) PIC 18F' Instruction Set Summary 'pdf' file I created several years ago, if you're interested.

    I found it handy to pin the sheets onto the cork board directly in front of my desk when I was starting out with the 18F' devices.

    I also have a 1 page 11x17 version if you or anyone would like it...

    Have fun, Mike
    Have one for the 16f series?

+ Reply to Thread
Page 1 of 2
1 2 Last

Similar Threads

  1. Question about Inchworm+
    By Quan in forum Micro Controllers
    Replies: 54
    Latest: 28th October 2007, 12:21 AM
  2. PicBasic Keypad program
    By Sora in forum Micro Controllers
    Replies: 0
    Latest: 20th April 2004, 07:02 PM

Tags for this Thread