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

    Default Problem with SEROUT after compiling with PBP3

    Help needed.
    I have a display unit with a program created originally with PBP 2.5 that has been working correctly for many years.
    The unit uses a 16F876A and has a USB interface that sends ASCII to a PC.
    The units function and data displayed on the PC worked OK.

    A few days ago I needed a small hardware change so decided to alter the program to display a different version in the header sent to the PC.

    I changed the :-
    @ DEVICE pic16F876A, hs_osc, wdt_on, pwrt_on, lvp_off, protect_on
    to :-
    #CONFIG
    __config _FOSC_HS & _WDT_ON & _PWRTE_ON & _BODEN_ON & _CP_ALL & _LVP_OFF
    #ENDCONFIG

    In my header the change was from :-
    serout USBport,T9600,[12,"*** Diagnostic Display Unit v1.3 ***",13,10]
    to :-
    serout USBport,T9600,[12,"*** Diagnostic Display Unit v1.4 ***",13,10]

    Compiled and loaded OK except now the PC does not receive valid data.
    If I load in the 1.3 version originally compiled with PBP2.5 all works OK.
    If I then load in the changed version created with PBP3 then the Serout data is corrupted (no display or strange characters).

    The only changes made were the #Config and the single change to the Serout line.

    I downloaded and installed the latest versions of PBP3 (3.0.7.4), latest MPLAB 8.90 and MCSP 5.0.0.5 and melabs programmer 4.50.
    Compiled and loaded the program again and still incorrect operation.

    I tried replacing Serout with:-
    Serout2 USBport, 84,[12,"*** Diagnostic Display Unit v1.4 ***",13,10] and the display behavior is incorrect and identical to the Serout.

    I removed the #CONFIG lines and set the config bits manually in the programmer --- still not working correctly.

    I reduced the speed down to 1200 but problem persists.

    Anyone have any suggestions ?

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    What if you don't use this?
    _BODEN_ON

    Is your voltage stable?

    Edit: Did you select correct PIC in MCS dropdown list?

    Robert
    Last edited by Demon; - 14th June 2013 at 14:33.

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

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    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.

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

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    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

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

  8. #8
    Join Date
    Sep 2013
    Posts
    4


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    Thanks for that. I will give it a go.

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