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

    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.

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

  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

    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.

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

  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

    OK, some developments and clarity on what is going on.....

    I worked out that I updated to MCSP 5.0.0.5 a year after my purchased upgrade period had expired, so thought it may be related to doing an upgrade without a valid activation key and hence some limiting factor with MCSP.
    So, I paid for the latest MCSP update and installed it.
    The latest version is 5.0.0.5
    Opened my original .PBP, modified it (config stuff only), compiled and loaded.
    Serout still does not work.

    Then....
    I took the file I created (see my last post above) with the latest MCSP and where I had typed in the basic setup for my 16F876A and that had worked and then pasted in the rest of the code from my original file.
    It works !

    So, in my case, it is definitely something to do with .PBP created with old MCSP and modified in new MCSP.

    It is either a formatting difference between the old version and new version .PBP files within MCSP
    or
    It could be a general issue with versions of MCSP
    or
    It could be only my specific case and that my .PBP file was corrupted some time in the past and that the new MCSP is sensitive to that.

    Not sure yet.

    I have raised this with Mecanique and am awaiting a response.

    Thanks for all those that replied... helped me focus down to what the issue really is.
    If I hear back from Mecanique I'll do an update to this thread.

  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

    Muzza,
    I had somewhat of a similar problem when using Darrel's Instant Interrupts.
    When I copied/pasted his posted code over my typed "problem" code of the exact wording, it worked!

    I thought he had some type of special code in his typed code. But it turned out that I had the Reserved Word Formatting set to "Uppercase all" so I fooled myself into thinking I typed a certain word uppercase when it wasn't.
    I immediately changed it to "Default" so I would see what I'm actually hen pecking!

    The MSCP setting is under: View --> Editor Options --> Highlighter, then Reserved Word Formatting at the bottom.

    You have yours set to "Lowercase all" which may be hiding the real typed word causing the headache!
    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

    Yes, it was set to lowercase.
    I set it to Default.

    Looked through the code but could not see anything untoward.
    Even pressed Enter at the end of each line in case there was some characters to the far right off screen... but no.

    Note that Define and Include comes up in Code Explorer, on the left in MCSP, regardless of the case used for those statements.

    I then opened my original .PBP deleted the @DEVICE line and typed in the Config stuff, compiled and loaded.
    Still the same problem.
    I then restored my original .PBP and deleted the @DEVICE line, compiled, set OSC to HS in the programmer and loaded.
    Still the same problem.
    I then opened a new file and copied and pasted the entirety of the original file, deleted the @DEVICE line, and set the Config bits in the programmer.
    Still the same problem.

    The only thing that worked was as in a few posts above where I opened a new file, hand typed the lines needed to get Serout working and then pasted in the balance of my program.
    If there is a corruption then it must be at the top but I cannot see it after scanning that section a bunch of times.
    Hmmm...

  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

    Hi Muzza.
    Did you ever find a solution to this problem?
    I am trying to convert a program with SEROUT to PBP3 and just have garbage on the serial LCD screen.

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

    I'd be curious to see what a compare utility would generate. We used to have these in mainframe programming; great for finding muckups like this one.

    Robert

    Edit: something like this
    http://www.prestosoft.com/edp_examdiff.asp
    Last edited by Demon; - 10th October 2013 at 19:58.

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