Problem with SEROUT after compiling with PBP3


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    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

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

  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

    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.

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


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    Can you blink an LED?

    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

    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.

  6. #6
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: Problem with SEROUT after compiling with PBP3

    Noticed that your posted "define" is not uppercase. It will be ignored and the clock speed will default to 4MHz throwing off your expected SEROUT generator baud rate.
    Louie

  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

    LinkMTech, when I type in "DEFINE" in uppercase it is converted to lowercase in MCSP.
    Same is true for INCLUDE and for #ENDCONFIG - these are also converted to lowercase automatically by MCSP.
    Note that #CONFIG stays in uppercase.

  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

    OK, something interesting....

    I opened a new tab in MCSP and physically typed the following (shown as it appeared in MCSP):-

    define OSC 8
    include "modedefs.bas"

    #CONFIG
    __config _HS_OSC & _WDT_OFF & _BODEN_OFF & _PWRTE_OFF & _CP_OFF & _LVP_OFF
    #endconfig

    ADCON0 = $00
    ADCON1 = $07
    TRISB = %00000011
    USBport var PortB.5

    Once var bit
    Once = 0

    pause 1000

    mainloop:
    if once = 0 then
    SEROUT USBport,T9600,["TEST",13,10]
    once = 1
    endif
    goto mainloop

    AND IT WORKED !!

    I then modified the striped down file to be exactly the same as the above and IT DOES NOT WORK.
    The "striped down" file was the original .PBP saved as another named file and then the bulk of the lines deleted.

    It appears that it has something to do with the .PBP file created with the old version MCSP ???
    This could explain why my recent use of Serout on the 16F88 worked as that code was created within the PBP3 version of MCSP.

    I went back to old backups and tried those...same problem.
    Could it be a corrupted .PBP file or some strange incompatibility between files created in the old version MCSP and the new PBP3 version ?

    I'll post a question to Mecanique and see what they suggest.

    Depending on what Mecanique come back with I will play around with recreating the 16F876A code, although, am not keen to retype 780-odd lines... will see how much I can paste.

    This is a weird one !!

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