ICD, ICSP and Picbasic Pro


+ Reply to Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Posts
    16


    Did you find this post helpful? Yes | No

    Smile MCSP and ICSD

    Thanks Bruce and Robert. Since I posted the original post I have purchased the full MCSP package but I have not tried the ICD method again. I had assumed that what Bruce said was the correct method and no bootloader was required.

    My original problem was that it worked fine on a sample program that I believe I got off the Rentron site. So I know the basic hardware was good. When I tried it on an actual project it would hang up after the first few executable lines - and not always in the same place. I don't remember what the project was now but I think the problems came during the initialization portion.

    All my 'stuff' is at my office and when I get a chance I'll try the ICD again with the new MCSP.

    Thanks again, Mark

  2. #2
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Unhappy Why do I get a compilation error ???

    Hi All,

    Havent used the ICD feature before but this thread has made me take a closer look at it.

    I decided that my current project will benefit from this as I currently have loads of code stuffed in there to try and debug what is happening but have realised that if I use ICD then I dont need it.

    The problem I have is with this section of code

    For CharCount = 0 to NameCount
    Hserout [Name[CharCount]]
    Next CharCount
    Hserout [10]
    Hserout ["IP: ",DEC IP[0],".", DEC IP[1],".", DEC IP[2],".", DEC IP[3],10] 'Display IP Address

    The two lines in bold fail with the message "Bad Expression" but ONLY when I compile with ICD (CTRL+F9).
    If I compile normally (F9) then it compiles without errors!!

    Any ideas ?

    Thanks
    Keith

    www.diyha.co.uk
    www.kat5.tv

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


    Did you find this post helpful? Yes | No

    Default

    HSERIN/OUT commands opened up a Serial Window when I executed them in ICD. At first glance I can't see what is wrong with your code.

    What about the HSER definitions in your program, what does that code look like? Baud rate, etc.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    Sep 2005
    Posts
    16


    Did you find this post helpful? Yes | No

    Smile ICSD and HSEROUT

    I believe that the ICD uses the hardware UART of the target PIC to communicate with MCSP. My guess is that you can't do both - run the ICD AND use the hardware UART under your program control. The complier is raising an error when it sees the HSERIN/OUT command when compiling for ICD use.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default

    I suspect it's this line Hserout [Name[CharCount]]

    How is this supposed to work? I.E. how are your variables/constants defined?

    EDIT: Found the solution. Enclose all your array elements in parenthesis VS
    square brackets.

    For CharCount = 0 to NameCount
    Hserout [Name(CharCount)]
    Next CharCount
    Hserout [10]
    Hserout ["IP: ",DEC IP(0),".", DEC IP(1),".", DEC IP(2),".", DEC IP(3),10] 'Display IP Address

    Works as expected.
    Last edited by Bruce; - 30th July 2006 at 17:39.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce
    I suspect it's this line Hserout [Name[CharCount]]

    Found the solution. Enclose all your array elements in parenthesis VS
    square brackets.

    Hserout [Name(CharCount)]

    Works as expected.
    Excellent. Thanks Bruce.

    I also found out that instead of

    For CharCount = 0 to NameCount
    Hserout [Name(CharCount)]
    Next CharCount

    it would compile with a single line of

    Hserout [STR Name\Namecount]

    which would achieve the same result although "Namecount" would have to be one higher than in the For/Next example.

    What I dont understand is why the ICD compile gets upset with the square brackets when the ordinary complier accepts it.

    I use the following two bits of code in the same program which follow the same style and both of those are fine.

    For CharCount = 0 to NameCount
    Read NameBase + CharCount,Char
    Name[CharCount]=Char
    Next CharCount

    For CharCount = 0 to NameCount
    LCDout Name[CharCount] ' Boot message.
    Next CharCount

    It would appear that it is only a problem with Hserout because that command requires square brackets as part of its syntax.
    Just tried Hserin with the line Hserin [Name[Namecount]] and that compiles fine with [] or () around the array element.

    Mighty strange, will drop David Barker an email to let him know of the inconsistency between the two compiles.
    Keith

    www.diyha.co.uk
    www.kat5.tv

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


    Did you find this post helpful? Yes | No

    Default Re: ICD, ICSP and Picbasic Pro

    Quote Originally Posted by keithdoxey View Post
    ...It would appear that it is only a problem with Hserout because that command requires square brackets as part of its syntax.
    Just tried Hserin with the line Hserin [Name[Namecount]] and that compiles fine with [] or () around the array element....
    (old thread, but hey, information is information)

    I wouldn't be surprised if it had to do with this:

    https://www.picbasic.co.uk/forum/sho...?p=909#post909


    When in doubt, rummage through Melanie's and Darryl's old posts. They've discussed all sorts of obscure stuff over the eons.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Replies: 1
    Last Post: - 10th December 2007, 23:57
  2. MPLAB ICD ver 1 & 16F628A
    By Tissy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th February 2005, 00:44

Members who have read this thread : 7

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