Serout/serout2


Closed Thread
Results 1 to 11 of 11

Thread: Serout/serout2

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    As far as i'm aware of, Stamp and PBP is not as this different... can you post the Stamp code?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2

    Default SEROUT re

    Mr. E, I feel like the guy at the piano. Here's the BS2 code
    FM CON 14
    HIGH FM
    Start_Up:
    SEROUT FM,396,[$55,$00] '00 is the stop command
    PAUSE 5000
    SEROUT FM,396,[$55,$03,$40] 'first speed command
    PAUSE 5000
    SEROUT FM,396,[$55,$03,$80] 'second speed command

    This repeats through several speed steps and loops back with GOTO Start_Up: The $55 is the sync, $03 is the set DC speed and the last part of the string is the 00 to FF speed levels. Details of this are from the Solutions Cubed group.
    I tried using SEROUT and SEROUT2 with different mode numbers, string precedes, INCLUDES, DEFINES. Since the pinouts are different between the BS2 and 16F628 I could have had the pin path wrong. I tried to work this out with no change. Thanks for any help with this. JS

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    mm are you saying that even if you change our code to...
    Code:
    FM VAR PORTB.4
    HIGH FM
    Start_Up:
        SEROUT2 FM,396,[$55,$00] '00 is the stop command
        PAUSE 5000
        SEROUT2 FM,396,[$55,$03,$40] 'first speed command
        PAUSE 5000
        SEROUT2 FM,396,[$55,$03,$80] 'second speed command
    It doesn't work???

    you must use SEROUT2 to be BS2 compatible with the baudrate definition. 396 should be 2400,8,N,1. If you want to use SEROUT you'll write it like..
    Code:
    FM VAR PORTB.4
    HIGH FM
    Start_Up:
        SEROUT FM,0,[$55,$00] '00 is the stop command
        PAUSE 5000
        SEROUT FM,0,[$55,$03,$40] 'first speed command
        PAUSE 5000
        SEROUT FM,0,[$55,$03,$80] 'second speed command
    HTH
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4

    Default SEROUT re

    I tried both versions with the same result. I added DEFINE CHAR_PACING with different values, no go. I wrote a blink routine for PORTB outputs and they all checked good. The MCS is a little tricky to work with so I have been double checking the parameters before programming. I am using the internal osc. and have DEFINED it so in some programs, again no change. My scope is down with a bad cap and the part won't be in for awhile so there isn't a good way to look at the output. Digital voltmeter and connection checks show nothing unusual. Not a very good day at the keyboard. I seem to have hit the brick wall. Later JS

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    If you use MPASM as assembler try...
    Code:
        @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _LVP_OFF & _BODEN_ON 
             ' Internal Oscillator
             ' Enable watch dog timer
             ' Enable power up timer
             ' Disable MCLR pin
             ' Disable low voltage programming
             ' Enable brown out detect
    if you use PM as assembler, look and try all the suggestion in the FAQ section. There's a full thread wich discuss of HOW TO.

    here it is => http://www.picbasic.co.uk/forum/showthread.php?t=543
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6

    Default SEROUT re

    If the MCS config. options list is correct regarding the device setup, why should it be necessary to add the redundant assembly code? Which has last say, the actual program code or the IDE controlling the up load. Never the less when I try adding the device config lines as they are presented from the site all I get is:
    ERROR 16F628~5 ASM 45:[235] opcode expected instead of 'PIC16f628'

    If I take the 16f628 out of the line, the error code changes to:
    ERROR 16F628~ 5 ASM 45: [235] opcode expected instead of intc_osc_noclkout

    The basic questions are:
    What am I doing wrong regarding the code? If the program is OK,
    Is it a hardware or sofware problem? Other options woulld be to: try another chip or install PBP into the MPLAB. I'm not ready for the latter. I guess my frustration is showing. JS

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    O.K. Let's try something first. A very simple test program test to send a text string to your PC via COM port. You'll use the MCS serial communicator (F4 then F9 to connect to the PORT)

    Code:
        '
        '    Hardware configuration
        '    ======================
        @ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _LVP_OFF & _BODEN_ON 
             ' Internal Oscillator
             ' Disable watch dog timer
             ' Enable power up timer
             ' Disable MCLR pin
             ' Disable low voltage programming
             ' Enable brown out detect         
    
        TRISB=0                            ' PORTB : output to all i/o
             
        '                      
        '    Hardware connection
        '    ===================
        SerPin         var PORTB.4         ' Serial data out connected via 1K resistor
                                           ' to PIN 2 of PC DB9 connector
                                           ' Don't forget the GND :o)
        
        '
        '    Serial Communication definition
        '    ===============================
        BAUD           con 16780           ' 2400 Baud, Driven inverted, No Parity          
    
        '
        '    Software/Hardware initialisation
        '    ================================
        serpin = 0                         ' Set Serial data out to normal state  
        pause 100                          ' safe settle time
        
        '
        '    ////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\        
        '
        '                             Program Start Here                               
        '
        '    ////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\        
        '    
    START:
        SEROUT2 SERPIN,BAUD,["PC COMMUNICATION TEST",13,10]
        PAUSE 500
        GOTO START
    if you use PM as assembler, use the following config fuses OR set them manually.
    Code:
        '
        '    Hardware configuration
        '    ======================
        asm     
            DEVICE PIC16F628, INTRC_OSC_NOCLKOUT ; Internal Oscillator
            DEVICE PIC16F628, WDT_OFF            ; Disable watch dog timer
            DEVICE PIC16F628, PWRT_ON            ; Enable power up timer
            DEVICE PIC16F628, MCLR_OFF           ; Disable MCLR pin
            DEVICE PIC16F628, BOD_ON             ; Enable brown out detect    
            DEVICE PIC16F628, LVP_OFF            ; Disable low voltage programming
            ENDASM
    is the above work?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Serout/Serout2 on pin RC6
    By Ioannis in forum Serial
    Replies: 14
    Last Post: - 12th December 2008, 20:06
  2. Serout/Serout2 and PIC18F97J60 (100 pin)
    By mikebar in forum Serial
    Replies: 10
    Last Post: - 20th May 2008, 05:16

Members who have read this thread : 1

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