Getting started with programming pics in Basic

Post here to discuss programming with swordfish basic

Moderators: Chuckt, Garth, bitfogav

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by brad » Wed Aug 11, 2010 12:32 pm

I should have got swordfish instead of proteus :cry:

FreeThinker
decided to stick around...
decided to stick around...
Posts: 25
Joined: Mon Aug 02, 2010 1:13 am
Location: UK
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by FreeThinker » Thu Aug 12, 2010 2:19 am

brad wrote: It's a nice piece of software isnt it!

It's quite straight forward to use and basic is such a nice language.

I had no idea about the plugin - where is that located / how do you access it?

Apparently they are developing a 24f series compiler but unsure of the release date.
http://www.sfcompiler.co.uk/wiki/pmwiki ... er.Plugins
It's the first item on the page.
Machines were mice and men were Lions once upon a time........But now that it's the opposite its twice upon a time. MooNDoG

FreeThinker
decided to stick around...
decided to stick around...
Posts: 25
Joined: Mon Aug 02, 2010 1:13 am
Location: UK
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by FreeThinker » Thu Aug 12, 2010 2:31 am

brad wrote: Apparently they are developing a 24f series compiler but unsure of the release date.
Sword Fish has not been updateed for over a Year .David Baxter the developer has not been on the forum for a LONG time.Rumours abound that he has abandoned the project due to work comittments.Check out the forum http://www.sfcompiler.co.uk and the links to the wiki.Main hope at the moment is that David releases the source code to a third party developer or the sword fish community,we can only wait and see.Hope it suvives as a product as it it so much easier than Proton (picbasic) or Mikrobasic.
Machines were mice and men were Lions once upon a time........But now that it's the opposite its twice upon a time. MooNDoG

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Post by bitfogav » Thu Aug 12, 2010 3:44 am

Sword Fish has not been updateed for over a Year .David Baxter the developer has not been on the forum for a LONG time.Rumours abound that he has abandoned the project due to work comittments.Check out the forum http://www.sfcompiler.co.uk and the links to the wiki.Main hope at the moment is that David releases the source code to a third party developer or the sword fish community,we can only wait and see.Hope it suvives as a product as it it so much easier than Proton (picbasic) or Mikrobasic

Yeah ive seen a few forums stating all kinds of romours, but I have read that David Baxter (SF developer) had a good reason he was away for a while which was personal, that is just a statment from Steven, who is the swordfish forum Moderator..

FreeThinker
decided to stick around...
decided to stick around...
Posts: 25
Joined: Mon Aug 02, 2010 1:13 am
Location: UK
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by FreeThinker » Tue Aug 17, 2010 9:52 pm

bitfogav wrote: Yeah ive seen a few forums stating all kinds of romours, but I have read that David Baxter (SF developer) had a good reason he was away for a while which was personal, that is just a statment from Steven, who is the swordfish forum Moderator..
First an apology to David, its David Barker no Baxter,Sorry :oops: my Bad!
I really like swordfish and will use it a lot more when I grow into the 18f family.Only using the 16f family at the moment as that is my dev hardware platform for time time being.Tried some example code for the LCD and found that it (sf) did not support "scrolling" of the screen, text slicing was the only way forward.Closer examination of the code (the inc lcd.bas file) showed a list of public constants and a command( ) function.This code sent a command code to the lcd then a data byte for the required action ie cls, move cursor, etc. It was a simple matter to declare a couple of constants in the program and call command(new constant) to implement the scroll screen right or left.This was possible ONLY because the source code for the library routines is supplied.It would a be a simple matter to include these new constants in the include file file and have them available to all routines.This is truly awesome openess and makes sf so very powerful.
Machines were mice and men were Lions once upon a time........But now that it's the opposite its twice upon a time. MooNDoG

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by brad » Tue Aug 17, 2010 10:10 pm

That's some very handy info there, thanks for sharing :)

It is fantastic that all the user modules are open source which means you can do exactly what you were talking about - modify them to suit your needs.

We were discussing a while ago about how to get scrolling text via swordfish, and perhaps we now have our answer :)

FreeThinker
decided to stick around...
decided to stick around...
Posts: 25
Joined: Mon Aug 02, 2010 1:13 am
Location: UK
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by FreeThinker » Tue Aug 17, 2010 11:44 pm

brad wrote:That's some very handy info there, thanks for sharing :)

It is fantastic that all the user modules are open source which means you can do exactly what you were talking about - modify them to suit your needs.

We were discussing a while ago about how to get scrolling text via swordfish, and perhaps we now have our answer :)
Urm don't know about the library files being open source, just the source code is available.Think DB still retains copyright.The files are locked (ie read only) not a big problem but intended to protect the files.Backup any mods first :D.I will post more details if required but basically all I did was create two constants:-

Code: Select all

 Public Const
 cmdDisplayRight = %00011100,
 cmdDisplayLeft = %00011000
(no real need to make them public )

Then a call such  as Command(cmdDisplayRight) will scroll right (string moves to the LEFT)
Here is the code as I bashed it about for testing.

// if device and clock are omitted, then the compiler defaults to 
// 18F452 @ 20MHz - they are just used here for clarity...
Device = 18F452
Clock = 20
#define isis_used
// some LCD options...
#option LCD_DATA = PORTB.4
#option LCD_RS = PORTB.3
#option LCD_EN = PORTE.2
Dim index As Byte
// import LCD library...
Include "LCD.bas" 
Include "utils.bas"
'The Two Constants below should be added to the LCD.bas INC files Later
 Public Const
 cmdDisplayRight = %00011100,
 cmdDisplayLeft = %00011000
// program start...
SetAllDigital
Cls()
DelayMS(250)
WriteAt(1,1,"Hello World this line is 40 characters *Wot happens next?")
DelayMS(1000)
Command(cmdBlinkOn)
loop:
Command(cmdDisplayRight)
DelayMS (1000)
GoTo loop
The line Hello World is 40 characters long to the * so what does happen next? :D .Think the original code is a SF sample file.
As I have seid before I DON'T have an 18F platform to test so I used the Oshon 18F simulator after removing the delays as it is not real time.It works as expected but is only a simulation.
Machines were mice and men were Lions once upon a time........But now that it's the opposite its twice upon a time. MooNDoG

FreeThinker
decided to stick around...
decided to stick around...
Posts: 25
Joined: Mon Aug 02, 2010 1:13 am
Location: UK
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by FreeThinker » Tue Aug 17, 2010 11:52 pm

FreeThinker wrote: As I have seid before I DON'T have an 18F platform to test so I used the Oshon 18F simulator after removing the delays as it is not real time.It works as expected but is only a simulation.
Opps forgot to put link to Oshon site http://www.oshonsoft.com/
Machines were mice and men were Lions once upon a time........But now that it's the opposite its twice upon a time. MooNDoG

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by brad » Wed Aug 18, 2010 6:16 am

This is so cool!

It's such a simple solution to a problem that I couldn't figure out. The good thing is that I have a use for it with my LED games - thanks very much for posting. :D

I am guessing that these two 8-bit numbers are specific commands built into the LCD displays:

Code: Select all

%00011100,
%00011000 
Is that right?

FreeThinker
decided to stick around...
decided to stick around...
Posts: 25
Joined: Mon Aug 02, 2010 1:13 am
Location: UK
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by FreeThinker » Wed Aug 18, 2010 7:46 am

brad wrote:This is so cool!

It's such a simple solution to a problem that I couldn't figure out. The good thing is that I have a use for it with my LED games - thanks very much for posting. :D

I am guessing that these two 8-bit numbers are specific commands built into the LCD displays:

Code: Select all

%00011100,
%00011000 
Is that right?
When power is applied to the lcd display it runs its internal init routine and defaults to an 8 bit data bus with its display cleared and pointing to its first memory location.Any data received is now used to index into an internal character map and the bit pattern copied to the current cursor location and then incremented.Certain data is interperated as a command code and thedisplay switches to command mode.the next data byte is then decoded as the required action.When completed the display returns to its previous mode.You can clearly see how the function command(data) now works all you need to know now is the command code list.90% of displays are based on the industry standard hd44780 by hitachi, cloned by many others.You need to find the data sheet for your display and check.I've attached the data sheet for the lcd controller for my display which is the same as most others, page 13 has a nice table of codes.Happy reading.
PS How will these (LCD Specific) commands help with a Led Matrix, are they controlled with a hd44780?
Attachments
CM200400GFAYC-01.zip
Page 13 gives some good Tables
(497.05 KiB) Downloaded 653 times
Last edited by FreeThinker on Wed Aug 18, 2010 8:01 am, edited 3 times in total.
Machines were mice and men were Lions once upon a time........But now that it's the opposite its twice upon a time. MooNDoG

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Post by bitfogav » Wed Aug 18, 2010 7:51 am

When power is applied to the lcd display it runs its internal init routine and defaults to an 8 bit data bus with its display cleared and pointing to its first memory location.Any data received is now used to index into an internal character map and the bit pattern copied to the current cursor location and then incremented.Certain data is interperated as a command code and thedisplay switches to command mode.the next data byte is then decoded as the required action.When completed the display returns to its previous mode.You can clearly see how the function command(data) now works all you need to know now is the command code list.90% of displays are based on the industry standard hd44780 by hitachi, cloned by many others.You need to find the data sheet for your display and check.I've attached the data sheet for the lcd controller for my display which is the same as most others, page 13 has a nice table of codes.Happy reading.
PS How will these (LCD Specific) commands help with a Led Matrix, are they controlled wit a hd44780?
wheres tha datasheet?

FreeThinker
decided to stick around...
decided to stick around...
Posts: 25
Joined: Mon Aug 02, 2010 1:13 am
Location: UK
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by FreeThinker » Wed Aug 18, 2010 7:54 am

bitfogav wrote:
When power is applied to the lcd display it runs its internal init routine and defaults to an 8 bit data bus with its display cleared and pointing to its first memory location.Any data received is now used to index into an internal character map and the bit pattern copied to the current cursor location and then incremented.Certain data is interperated as a command code and thedisplay switches to command mode.the next data byte is then decoded as the required action.When completed the display returns to its previous mode.You can clearly see how the function command(data) now works all you need to know now is the command code list.90% of displays are based on the industry standard hd44780 by hitachi, cloned by many others.You need to find the data sheet for your display and check.I've attached the data sheet for the lcd controller for my display which is the same as most others, page 13 has a nice table of codes.Happy reading.
PS How will these (LCD Specific) commands help with a Led Matrix, are they controlled wit a hd44780?
wheres tha datasheet?
Whoa! you are Quick....Edited posting original would not take pdf files :D
Machines were mice and men were Lions once upon a time........But now that it's the opposite its twice upon a time. MooNDoG

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Post by bitfogav » Wed Aug 18, 2010 7:57 am

HaHa! I was just interested in this because I have used LCDs alot in assembly and I have now switched to swordfish so this would be very usefull :)

and oh yeah i dont think you can upload PDF files on this forum hehe.

FreeThinker
decided to stick around...
decided to stick around...
Posts: 25
Joined: Mon Aug 02, 2010 1:13 am
Location: UK
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Post by FreeThinker » Wed Aug 18, 2010 8:03 am

bitfogav wrote:HaHa! I was just interested in this because I have used LCDs alot in assembly and I have now switched to swordfish so this would be very usefull :)

and oh yeah i dont think you can upload PDF files on this forum hehe.
Has the attachment worked?I cannot see it' but is there in preview?
Machines were mice and men were Lions once upon a time........But now that it's the opposite its twice upon a time. MooNDoG

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Post by bitfogav » Wed Aug 18, 2010 8:05 am

FreeThinker wrote:
bitfogav wrote:HaHa! I was just interested in this because I have used LCDs alot in assembly and I have now switched to swordfish so this would be very usefull :)

and oh yeah i dont think you can upload PDF files on this forum hehe.
Has the attachment worked?I cannot see it' but is there in preview?
No sorry buddy it hasn't worked, do you have a link to the PDF file ?

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 13 guests