Welcome! Log In Create A New Profile

Advanced

ByPic Tutorial

Posted by chipfryer27 
ByPic Tutorial
May 25, 2015 11:56PM
Hi

I'm a complete newbie with ByPic and I've just obtained the BV500 Kit, installed rookie v3.0 as per the user guide and I'm working my way through the tutorials. However, having reached the 7-Segment Display examples I'm running into a bit of trouble.

When I download the following tutorial in PSPad and "F4" I get an error report informing of errors in Line 68 and Line 86.

[byvac.com]

I compared the download with the expanded code and Line 68 is different (amongst others). I attributed my problem with the download to my version of rookie which doesn't use the table functions but instead uses curly brackets {}.

I copied and pasted the expanded code (with curly brackets) but I still get the same error messages which are:
ERROR <27> <DIGIT$>
ERROR <0> <n>>

I've looked up the error codes and tried to modify the code based on info contained in Key Words, but I can't get it to work.

I've looked through the forum/faq but can't see anything related, so hopefully someone reading this can put me in the right direction.

Thanks in advance.
Re: ByPic Tutorial
May 26, 2015 02:29PM
** edit: rookie2 should be downloaded not rookie3 **
Welcome to ByPic,
The BV500 kit contains a BP1 (more details of this particular device). This now has an PIC32MX170, the older versions of BP1 had a PIC32MX150.

The main difference from a ByPic point of view is that the MX150 uses version 2.0n firmware and the MX170 uses 2.3n firmware. The newer firmware amongst other things allows passing of arrays to functions which has made rookie much simpler and more logical. For example if an LED were connected to PORTA bit 4 then:

constant LED {PORTA(PORT),4}

Now the program can refer to *LED() that contains all of the information to set and reset the hardware line. But that does not really answer the question.

From what you say it looks as though you have tried to load or have loaded rookie 1 instead of rookie 3. To be sure do the following:
1) flclear(0) // this clears all of the previous saves
2) use rookie 3 (http://byvac.com/mBlib/flb/Library/rookie/BP1MX170_rookie3.script) CRTL+SHIFT+R to load a script once its in PsPAD

This will load without any errors. There may be some tutorial examples that that do not load under rookie 3, the fix should be easy but let me know if you come across any and I will update for rookie 3.
Jim



Edited 1 time(s). Last edit at 05/27/2015 10:34AM by jimeer.
Re: ByPic Tutorial
May 26, 2015 03:36PM
Hi Jim

Thanks for the help, appreciated

I grabbed a screensave before I followed your instructions and it claimed I was using rookie 3.0 however I don't see a way to attach any files to forum messages.

Anyway, I did the following:

flclear(0) - this brought me back to version 2.3.
Pasted your link into PSPad and clicked Open URL in Clip - this downloaded from the website.
I then pressed CTRL+Shift+R and sent the files to the chip.

Once complete I sent .r to reboot. I came back up with version 2.3. It informs I have 2 Saves. I redid everything again with the same result.

Any ideas?

Regards.
Re: ByPic Tutorial
May 26, 2015 04:33PM
sorry,
you have lost me: you loaded rookie3 okay, 2 saves are correct, reboot fine. Any ideas for what?
Re: ByPic Tutorial
May 26, 2015 07:46PM
Jim

After recieving the kit I followed instructions and loaded rookie Version 3.0. When I boot or reboot the "welcome" screen would state "BV500 - rookie installed Version 3.0" etc and I took a screenshot of it.

However after I followed your instructions above, the welcome screen now says "ByPic Version 2.3" etc. No mention is made of any rookie.

In addition, if I follow any tutorial the downloads fail if it contains a line with "io_pinMode" with error codes 31 and 28.

Any ideas as to what has went wrong?

Regards
Re: ByPic Tutorial
May 26, 2015 10:07PM
Jim

I seems that I cannot download rookie to the chip anymore. I have tried both the easy and hard ways and despite getting no errors the welcome screen still doesn't report any rookie and tuturials that previously worked when I had v3.0 (yesterday), now don't.

I'm now at a loss.

Regards
Re: ByPic Tutorial
May 27, 2015 08:43AM
You have loaded, successfully rookie3 probably many times.

I think there is a gap between what you expect to see and what you are seeing, for example when rookie 3 is loaded it does not say that rookie 3 is loaded it just is.

This is not your fault but the instructions were originaly for an older version and in some places they may have not been updated to 2.3 (I have had to keep it this way for a while for people with older kits). This is true of the instructions for installing rookie which I will get round to altering in due course so for now will you accept that you have loaded rookie 3 even though it does not say so as in the part 3 tutorial.

*** I have just had another look at part 3 tutorial and the loading rookie is just plane wrong for the newer firmware so I will fix that today. I think this has been the source of your problems (sorry my fault) so follow the instructions that I gave above after your first post ***

Which tutorial fails in the download? Please be more specific so that I can fix it for you.

Jim



Edited 1 time(s). Last edit at 05/27/2015 08:54AM by jimeer.
Re: ByPic Tutorial
May 27, 2015 09:35AM
Hi Jim

Thanks for your time.

I agree that I am probably downloading rookie 3 as fltell shows about a 20k use of memory.

My concern is that unlike a couple of days ago, I no longer get any indication of an installation of rookie upon boot/reboot. Until yesterday I would see after "system cold start" BV500 - rookie installed version 3.0 etc, now after "system cold start" I get Hardware Detect, ByPic Version 2.3 etc, no mention of rookie at all.

As I can no longer run tutorials that I could yesterday, before reloading rookie 3, I am of the impression rookie isn't running but of course I could be wrong.

Up until I followed your instructions to reinstall rookie 3, I could complete all tutorials up until the last tutorial in Section 5, (http://byvac.com/mBlib/flb/Tutorial/PIC32MX1_Family/2013/seven_seg_3.bas).

Now, I can only complete up to Section 4, before we start on Outputs. If I try and load the output_1.bas (http://byvac.com/mBlib/flb/Tutorial/PIC32MX1_Family/2013/output_1.bas)

1 // Output to LED on RA1
2
3 function go()
4 // set up RA0 for output
5 io_pinMode(PORTA,0,OUT,WOFF) // set RA0 as output
6 while comkey?(2) = 0
7 io_write(PORTA,0,TOGGLE)
8 wait(1000)
9 wend
10 endf

I'm informed of errors in line 5 (code 31 and 28) and the download stops. Any other download that has a similar line also fails.

Regards
Re: ByPic Tutorial
May 27, 2015 10:32AM
oops:
I am sorry, I have lead you done the wrong path. Rookie 3 is the latest rookie but the rest of the code on the site has not caught up. You need to download rookie2

http://byvac.com/mBlib/flb/Library/rookie/BP1MX170_rookie.script

The above is rookie 2. This will allow the use of version 2.3 and also enable you to run the tutorial code. Thanks for bringing this to my attention. I have now updated the tutorial (part 3) and yes with rookie 2 there is a sign on screen.

Let me know how you get on.

Jim
Re: ByPic Tutorial
May 27, 2015 11:27AM
Hi Jim

Thanks for your patience.

That now gives me back the "rookie installed Version 3" at reboot.

Now I'm back to my original problem from the top of the page.

When I try and download the last tutorial from Section 5 seven_seg_3.bas (http://byvac.com/mBlib/flb/Tutorial/PIC32MX1_Family/2013/seven_seg_3.bas) it stops at line 68 with:

error (27) <tble_get$>
error (0) <(>

If I look at the expanded code, I see it is quite different to the download. Copying and Pasting to PSPad and downloading to chip stops at line 68 with:

error (27) <DIGIT$>
error (0) <n>

It would appear that the hyperlink refers to a previous version of rookie to the expanded code. I'm guesing I should be using the code listed when expanded(?) so any idea as to why I can't download to the chip?

Regards
Re: ByPic Tutorial
May 27, 2015 11:46AM
yes it does.
I have updated the file bu changing the following:

// 0,1,2,3,4,5,6,7,8,9,dp"
//constant DIGIT$ {0x3f,0x30,0x5b,0x4f,0x66,0x6d,0x7c,7,0x7f,0x67,0x80}
constant DIGIT {0x3f,0x30,0x5b,0x4f,0x66,0x6d,0x7c,7,0x7f,0x67,0x80}

and
// *****************************************************************************
// Uses a table to set the segments to represent a number
// *****************************************************************************
function seg_number(n)
dim d
//    d = tbl_get$(?DIGIT$, n) // get digit from table
    d = DIGIT(n) // get digit from table
    io_setPortL(PORTB, ALLSEG) // turn off
    io_setPortH(PORTB, d)
endf

You can make the changes to the above 2 lines or just download the file again, beware though that PSPAD will cache so downloading again may not work until PsPad and serial are re-started.
Re: ByPic Tutorial
May 27, 2015 12:14PM
Hi Jim

I changed the lines on the expanded code that I copied and it now loads. I'll reconnect the display later and play.

Thanks for the help.

Regards
Re: ByPic Tutorial
May 27, 2015 01:44PM
Hi Jim

I kind of half expected it.

The next section, "Part 6 Timers" just returns error codes of 31 and 28 when trying to do enter/download to chip. I'm guessing the rest of the tutorials need updating / modifying as the first example of "Part 7 Interrupts" returns the same error codes.

Any workaround until things get updated?

Regards
Re: ByPic Tutorial
May 27, 2015 02:48PM
the updates code is here:
// *****************************************************************************
// *****************************************************************************
function timer()
dim n=1
    tmr_set(*TIMER23(), 1000000)
    print "\nThis will print a number every second"
    tmr_clr(*TIMER23()) // clear flag
    while comkey?(2) = 0
        if tmr_flag(*TIMER23()) <> 0 then
            print "\nNumber is now",n
            n = n + 1
            tmr_clr(*TIMER23()) // clear flag
        endif
    wend
endf
The change is that a timer is referred to know with *TIMER12() instead of ?TIMER23, thanks for letting me know so I can update the website
Jim
Sorry, you do not have permission to post/reply in this forum.