Problem with SEROUT after compiling with PBP3


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Posts
    14


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    Robert,
    Yes, voltage is stable.
    Yes, definitely selected 16F876A.
    Tried it with only _HS_OSC (am using a 8MHz crystal and Define OSC 8) and all other config items set to OFF ... no joy.
    Tried deleting all my program except the basic requirements to print one word of text i.e. serout PortB.5,T9600,[" TEST ",13,10]... no joy.
    If I load the old version HEX file it works perfectly.
    If I load a HEX file created with PBP3 it fails to print.
    Tried serout USBport,2,[12,"*** Diagnostic Display Unit v1.4 ***",13,10] with no modedefs.bas included and no joy.
    Tried another PCB assembly and another PC and behaviour is the same (no text on version compiled with PBP3 but works correctly with the old HEX file loaded).

    I also tried installing the PBP3 etc on an old PC I have (Windows XP) in case the issue was related to the Windows 7 on the PC I had been using... no joy there either.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    Hi,
    It looks like you might have the wrong syntax/constant name. Try:
    Code:
    #CONFIG
        __config _CONFIG1, _HS_OSC & _WDT_ON & _PWRTE_ON & _BODEN_ON & _CP_ALL & _LVP_OFF
    #ENDCONFIG
    /Henrik.

  3. #3
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    I think you have to indent the __config line. I know it sounds stupid but it may solve the problem.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    Yup, indentation counts in assembler. I think column 1 was for labels.

    Robert

  5. #5
    Join Date
    Nov 2005
    Posts
    14


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    Thanks, __CONFIG line was indented:-
    In one test I copied the example from the 16F876A.INFO file and only changed XT to HS.
    I have even removed the the #CONFIG/#ENDCONFIG completely and set the config bits via the programmer.
    Have tried a bunch of variations around the config bits down to having everything Off except OSC=HS (8MHz crystal)

    The software functions perfectly except for the corrupted Serout in all cases above.
    The software reads a data pulse train and timing is critical.
    There is a 3 digit LED display on the unit and that displays correctly...only Serout (or Serout2) does not work.
    My logic probe confirms that data is being sent but no variation of setup (baud, bits, stops, parity) in the PC will result in a display other that gobbledygook.
    BTW, my ASCII output is on RB5 and that pin feeds into a FTDI FT232R.

    So, methinks my issue is either:-
    Config (but I have tried heaps of variations there) or,
    a corrupted modedefs.bas (but I have tried Serout USBport,2,etc and I have tried Serout2) or,
    it is MCSP/PBP3/MPASM3 not being happy with the 16F876A (have tried two sets of hardware) or,
    some issue between MCSP/PBP3/MPASM themselves (have tried these loaded on Windows 7 and on XP).

    I did develop a little timing control unit (for variable wipers) using PBP3 and had Serout setup to help with development.
    The unit took input from the speed of the vehicle to vary the wipe timing and used Serout to get the speedo pulse rate vs speed.
    This was on a 16F88 and Serout worked just fine.... which why I am suspecting some issue between MCSP/PBP3/MPASM and the 16F876A ?

    I have not tried starting a new .PBP file and typing up the basic program needed to just get an ASCII output.
    I can also reload the older version of PBP (have the disks) onto the XP machine and see how that goes.

    BTW, I created this unit design over 5 years ago and they have performed without issue until recently when one site was not displaying data correctly.
    Tracked that down to a noise on the input signal (unique to the site) so I added some filtering to the input circuit... problem solved.
    I can leave it running with the old .HEX file for now.. changing the header is just a nicety.

    My issue is that, if in the future I do have an issue that needs to be fixed in software, this Serout issue is going to be a big problem... would rather find a solution sooner rather than later.

    Appreciate the queries raised so far... please keep going... there must be something ....
    Last edited by Muzza; - 14th June 2013 at 23:55.

  6. #6
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    From what I'm understanding you're saying is the only thing you changed in your probram was the config line. So, to me, there has to be something wrong with that. I'm not familiar with machine language but the formatting of that line doesn't match the manual. There is supposed to be a space between config and ampersand(&) character. You also say the line is indented but, may sound stupid, did you use tab and is tab giving enough columns for the asm to work?

    There also not the same config items from PBP2.6 to the PBP3.0 code snippet. Are those config names correct?

    If you do figure this out, please let us all know.

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,170


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    Can you blink an LED?

    Robert

  8. #8
    Join Date
    Nov 2005
    Posts
    14


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    AvionicsMaster1 - yes, only changed the CONFIG part.
    Does not matter if I delete the #CONFIG part from the code and set OSC=HS in the programmer... same result.
    I tried indent, just now, with TAB as well with varying number of spaces...same result.
    Contents of the Config line are as per PIC16F876A.INFO... see below.

    Robert - all other aspects work correctly:-
    The code determines the data from the incoming pulse stream and displays correctly on the 3 digit 7 seg display, operates a buzzer with a beep to advise on a new code being displayed etc. All this is based on pulse duration timings via interrupts and using Timer1.
    Except for Serout it all appears to be working correctly.

    My striped down code is as follows:-

    define osc 8
    include "modedefs.bas"

    #CONFIG
    __config _HS_OSC & _WDT_ON & _BODEN_ON & _PWRTE_ON & _CP_OFF & _LVP_OFF
    #ENDCONFIG

    ' Setup Ports
    ADCON0 = $00 'Disable AD ports
    ADCON1 = $07 'Disable AD ports
    Segments Var PORTC 'Data
    LEDdigit Var PORTA 'Control
    TRISC = $80 ' Set segment pins to output
    TRISA = $f0 ' Set digit pins to output
    PortC = $FF
    PortA = $FF
    TRISB = %00000011 ' Set RB0, RB1 i/p rest o/p
    TRISA = %00001000 ' Set RA3 i/p rest o/p
    USBport var PortB.5
    Buzzer var PortB.4
    Buzzer=0
    ModeSw var PortB.1
    Modesw=0

    Once var bit ; added so print only occurs once
    once=0

    pause 1000

    '=========== Print Header ==============

    mainloop:
    if once = 0 then
    serout USBport,T9600,[12,"*** Diagnostic Code Unit v1.4 ***",13,10]

    once = 1
    endif

    goto mainloop


    Note that if I use :-
    __config _HS_OSC & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _CP_OFF & _LVP_OFF
    Result is the same.

    ALSO, I noticed in this post that the Indent is missing from the __CONFIG line.
    The editor in this posting system must remove leading spaces.
    It is there in MCSP.
    Last edited by Muzza; - 15th June 2013 at 03:29.

Similar Threads

  1. Problem for compiling SDSF library.
    By Ziko87 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th August 2012, 08:17
  2. PBP3 Compilation problem
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 1st June 2012, 12:17
  3. TMR0 preset problem, PBP3.0
    By Norbert in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th December 2011, 19:36
  4. Problem compiling EasyHID code
    By mindthomas in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th August 2010, 20:46
  5. Problem with Compiling
    By tarexpanda in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th April 2007, 05:12

Members who have read this thread : 0

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