First Thing to Do In Swordfish

Discuss the Integrated Development Environment (IDE)

Moderators: David Barker, Jerry Messina

Post Reply
swordfishuser
Posts: 19
Joined: Sun Apr 09, 2017 7:07 pm

First Thing to Do In Swordfish

Post by swordfishuser » Wed May 03, 2017 10:58 pm

I've heard 'look at the samples and you'll figure it out.'

Well. I have done that with a couple languages/compilers and

haven't figured much out.

That might be for someone who already know another language.

What's one thing I can do in Swordfish that will 'move me along'?

Write the device line?

Thanks!
Last edited by swordfishuser on Thu May 04, 2017 7:24 am, edited 1 time in total.

bitfogav
Registered User
Registered User
Posts: 166
Joined: Sat Oct 09, 2010 1:39 pm
Location: United Kingdom

Re: First Thing to Do In Swordfish

Post by bitfogav » Thu May 04, 2017 5:06 pm

Have you checked out the Swordfish Language Guide?

http://www.sfcompiler.co.uk/downloads/SFManual.pdf

swordfishuser
Posts: 19
Joined: Sun Apr 09, 2017 7:07 pm

Re: First Thing to Do In Swordfish

Post by swordfishuser » Thu May 04, 2017 6:08 pm

That new post button could be in a better spot.

I wrote a nice reply for nothing.

Do I open a new source file or start a project to get started please?

bitfogav
Registered User
Registered User
Posts: 166
Joined: Sat Oct 09, 2010 1:39 pm
Location: United Kingdom

Re: First Thing to Do In Swordfish

Post by bitfogav » Thu May 04, 2017 6:19 pm

swordfishuser wrote:Do I open a new source file or start a project to get started please?
Neither, You just click on the "New" tab or press CTRL+N to get started. That will start you with a clean fresh page to write you're code.

swordfishuser
Posts: 19
Joined: Sun Apr 09, 2017 7:07 pm

Re: First Thing to Do In Swordfish

Post by swordfishuser » Thu May 04, 2017 6:39 pm

Thank you.

Goal is simplest program that will compile.

In Basic Stamp it is 'End'.

That command only.

What next to do that please?

Jerry Messina
Swordfish Developer
Posts: 1245
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: First Thing to Do In Swordfish

Post by Jerry Messina » Thu May 04, 2017 6:50 pm

Try the IDE Help menu and under topics select 'Creating and Using Programs' in the 'Language Reference' section.
After that it's up to you!
Goal is simplest program that will compile.
In Basic Stamp it is 'End'.
That command only.
And here's the simplest program that will compile in Swordfish:

Code: Select all





swordfishuser
Posts: 19
Joined: Sun Apr 09, 2017 7:07 pm

Re: First Thing to Do In Swordfish

Post by swordfishuser » Thu May 04, 2017 6:56 pm

Great!

Thank you!

Have to go.

Will be back in a couple hours.

swordfishuser
Posts: 19
Joined: Sun Apr 09, 2017 7:07 pm

Re: First Thing to Do In Swordfish

Post by swordfishuser » Thu May 04, 2017 11:52 pm

bitfogav and Jerry

How do you 'Debug' to terminal.

Example: Debug "Hello World".

"Killing two bird with one stone"

See if there ins terminal program in Swordfish and

coding and compiling first lines of code.

Bob

Jerry Messina
Swordfish Developer
Posts: 1245
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: First Thing to Do In Swordfish

Post by Jerry Messina » Fri May 05, 2017 9:56 am

There's no 'debug' terminal. You can use the pic uart to send stuff to a pc.
Here's a simple example based on the echo.bas program from the Samples folder

Code: Select all

// if device and clock are omitted, then the compiler defaults to 
// 18F4520 @ 20MHz - they are just used here for clarity...
device = 18F4520
clock = 20

// import usart module...
include "usart.bas"

usart.SetBaudrate(br19200)
usart.Write("Hello World")

// read in characters and echo to screen...
while true
   WriteByte(ReadByte)
wend
There's a simple serial terminal in the IDE... main menu 'Plugin | IDE Serial Communicator'

swordfishuser
Posts: 19
Joined: Sun Apr 09, 2017 7:07 pm

Re: First Thing to Do In Swordfish

Post by swordfishuser » Fri May 05, 2017 6:52 pm

Jerry

Thank you. That's a five star anwer. *****.

Looks like 'Learn By Doing' works.:)

Get back to you in a couple of hours.

Bob

swordfishuser
Posts: 19
Joined: Sun Apr 09, 2017 7:07 pm

Re: First Thing to Do In Swordfish

Post by swordfishuser » Tue May 09, 2017 7:06 pm

Will be ready to go with development board and 18F25K22 in a couple of days.

Looking forward to seeing what Swordfish is like.

Need to add communication interface to board. I think.

Post Reply