Serout/serout2


Closed Thread
Results 1 to 11 of 11

Thread: Serout/serout2

Hybrid View

  1. #1

    Question Serout/serout2

    I need to get hex values, such as hex55, hex03,hex40 as a string out to PORTB.4 for a 16F628 using PBP.The communication should be 8N1 true, no parity. What I'm up to is attempting to drive a small serial H bridge driver. I have tried various string code with different DEFINES and INCLUDES and none has worked. At best there is a small hum from the motor. I put the H-bridge back on the BS2 dev. board using Stamp code and it runs perfectly. If someone could post a SEROUT hex string example it would help. The PBP manual seems a bit vague regarding communication strings.Thanks JS

  2. #2
    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.

  3. #3

    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

  4. #4
    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.

  5. #5

    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

  6. #6
    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.

Similar Threads

  1. Serout/Serout2 on pin RC6
    By Ioannis in forum Serial
    Replies: 14
    Last Post: - 12th December 2008, 19:06
  2. Serout/Serout2 and PIC18F97J60 (100 pin)
    By mikebar in forum Serial
    Replies: 10
    Last Post: - 20th May 2008, 04: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