External Links

Creative Science Centre

 

IDE

The programming environment for ByPic is very flexible as it only relies on a standard serial connection and so any serial terminal will do. This text describes the preferred environment as it has been evolved over the years.

The IDE is contained within BvSerial (BVS) that can be downloaded from here.

When working with ByPic functions are types into the editor and then F4 is pressed to transfer those function to the device.

Note: If you already have PSPad installed then this does not have the extras such as scripts and user variables. So it is important that THIS instance of PSPad is run and not the one you already have installed or see FAQ

BvSerial + PSPad

1) Start BVSerail (BVS)

3) type .edit (dot edit) in the blck screen of BVS

Dot Edit will bring up the PSPad editor:

Add the above text or copy and paste from below, the press F4 which will transfer it to ByPic, in the back screen type hello.

// comment
function hello()
dim j
    for j = 1 to 10
        print "\r\nHello World"
    next
endf

Some Pointers:

  1. When pressing F4 the editor window needs to be active, i.e you have clicked in the window
  2. The focus normally transfers to the BVS windows when transfer is complete.
  3. To get rid of the project area on the left, nor shown in the images above press SHIFT+F2
  4. If it is not working then you may already have PSP installed, see pink note above

Editor Extras

Syntax Highlighter

The Hello World program shown in the picture is coloured that way because it has had ByPic syntax highlighting applied. This has been pre-installed so all that is necessary is to pick the icon choose ByPic to apply the highlighting.

Another feature of this highlighting is that with it applied, pressing ALT+F1will bring up the key words page for ByPic. An internet connection is required for this of course.

There is more information about changing the highlighter settings here.

Scripts Menu

This has mainly one very useful command and that is 'Open URL in Clip' so if you see any URL (file name) then you can copy it, go to the editor and invoke this command. As an example, select and copy the green text below.

http://byvac.com/mBlib/flb/Tutorial/PIC32MX1_Family/01_Start/project_2.bas

Now go into scripts and click on 'Open URL in Clip'

The contents are now in the edit area.

 

Internals

There are a few options for building an IDE and one of them was to use a standard editor control within say wxPython and do everything from there. The solution would be neater but building a complete program editor from scratch would be too big a task. Also the program editors that are available do a very good job, this one and Notepad++ is also very good.

The main problem is that serial communication as well as editing is required and BVS does a very good job of that particularly with the history (last commands repeat) and also the . commands (thanks Wordstar) that means the mouse is used less.

So how does F4 move the contents of the editor screen to the ByPci device? This is how.

  1. The contents of the edit screen are sent to the clipboard
  2. PSPad sends a message to BVS that the clipboard has a program
  3. BVS processes it.

In more detail.

1) The reason that PSPad is used is that it has a scripting (VBS, Java ro Python) interface that is able to work with the editor. In other words it can do things like capture the screen to the editor. Notepad++ is a more up to date editor but scripting relies on a plug in and I was unable to get one to work very well.

2) Now the contents of the clipboard have the required information a message needs to be sent to BVS to do something with it. The messaging is via a named pipe. This is similar to a file but isn't, quite frankly its a very poor method of communication but it is the only inter-program communication that VBS supports and then only one way. But it works. BVS is listening on this pipe all of the time and it treats any incoming message as if it were typed on the keyboard, so PSPad fills the clipboard and then sends the .clip command to BVS

3) BVS does all the real work. It will take the contents of the clipboard and sent it to the ByPic device in the correct format. The .clip command can also be used form the keyboard, make sure that it is in the correct format, type .h clip into BVS for more information.

It should be noted that in all of the exchanges only a small amount of information is sent via the named pipe, the bulk of the data being sent via other methods. The communication is only one way and so error messages cannot be reported back. so far this has not proved to be such a limitation.

Other applications could also use the pipe, it is called 'bvserial_pipe'. If you have a program that is able to open a pipe then try it!!

FAQ

1) There is no script menu on my copy of PsPAD?

This is because you are using an existing version of PSPad you have previously installed. The easiest solution is to not use it. Simply run BvSerial first then type .edit in the black terminal window. See also  question 3.

2) Is it possible to use the editor without BvSerial?

Yes: in the install directory, go inside the edit directory and double click on PSPad.exe

3) I already have PSPad installed can I use that instead of the one that comes with BvSerial?

Yes: You will need to copy some files form the BvSerial copy of PSPad to your own installed copy:

Variable.INI
\Script\VBScript\bypic.vbs
\Syntax\ByPic.INI

Then you will need to enable scripts in PSPad

Settings>Program Settings>System integration>Integrated scripting support (WSH)

4) The script menu looks different?

There are updates within the same BVS version so the version may be out of date, simply download again. The uploaded date is in on the download table.

History

Version 16_b July 2016

  • Scripts are no longer required as BVS noe supports // #include
  • This text only now includes F4 details, the other commands still exist but are not deemed to be useful.