• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Now the fun begins!!!

Status
Not open for further replies.

MrDEB

Well-Known Member
well I got my two books I ordered (one was supposed to have a cd but no cd, the other supposedly download source code but can't connect to website)
well that's the minor part of this fun post
I really like swordfish basic but one book is about assembly language and the other is pic basic and pic basic pro.
looking at the similarities of all this could be fun
Add to this, all the projects use the 16F series chip w/ external crystal oscillator.
Going to try out the simple led flashing prg but have to use MPLAB and the 18F1320 (God I love using the swordfish compiler)
will try and decipher and maybe learn something.
 

blueroomelectronics

Well-Known Member
Swordfish is awesome. Maybe your scouts and yourself could write the first Swordfish projects book. Make sure to download an read the many free Parallax books as they're a form of BASIC too. The BoeBot book is really nice.
 

MrDEB

Well-Known Member
E gads talk about taking the long road to nowhere

typed in the header and program code to turn an LED off and on every .5 seconds
I need to figure out a way to translate from this assembly garbage to swordfish
way easier.
I think swordfish this ame routine (flashing an LED every .5 seconds) can be done in under 5 lines of code??
sorry, I forgot how to post code??
Code:
;HEADER84.ASM
}
tmr0 equ 1  	;tmr0 is file1
STATUS equ 3 	;status is file 3
PORTA equ 5 	;portA is file5
PORTB equ 6  	;portB is file 6
TRISA equ 85H 	;trisa portA i/o selection is 85H
TRISB equ 86H 	 ;trisaB portB is i/o selection 86H
option_R equ 81H ;option regester file 81H
zerobit equ 2 	;zero bit is bit 2
count equ 0CH  	;count is file 0C regester to count events
;8888888888888888888888888888888888888888888888888888888888
list P=16F84 	; pic being used
org 0 			;start address
GoTo start 		;goto start
;88888888888888888888888888888888888888888888888888
; configure bits
-config H'3FF0'	; sets lp oscillator, wdt off, put on,code protect off
;88888888888888888888888888888888888888888888888888888888888
; subroutine section
; 1 second delay
delay1 clrf tmr0 ; start tmr0
loopa movf tmr0,w ; read tmr0 into w
sublw .32 ; time - 32
btfss status,
		zerobit ; check time - w = 0
		goto loopa ; time is not = 32
		retlw 0  ; time is 32 return
;.05 second delay
delayp5 clrf tmr0 ; start tmr0
loopb movf tmr0,w ; read tmr0 into w
sublw .16 ; time - 16
btfss status,
	  zerobit ; check time-w=0
goto loopb ; time is not =16.
retlw 0 ; time = 16 return  
; configuration section
start BSF Status.5		;turns to bank 1
	  movlw B'00011111; ;5 bits of port A are I/P
	  movwf trisa
	  movlw b'00000000'
	  movwf trisb 		;portb is output
	  movlw b'00000111' ; prescaler is /256
	  movwf option-r 	; timer is 1/32
	  bcf status.5 		; return to bank0.
	  clrf porta 		; clears port a
	  clrf portb ; clears portb
;88888888888888888888888888888888888888888888888888888888
; PROGRAM STARTS NOW
begin bsf portb'0 		; turn on b0
	call delayp5 		; wait .5 seconds
	bcf portb'0 		; turn off b0
	call delayp5		; wait .5 seconds
	goto begin 			; repeat
						;must end
end	  
	   
[end code]
 

MrDEB

Well-Known Member
looking over the PICBASIC book

now that looks more like what I have been using (swordfish)
thinking it would be cool to have a rogram that uses macros to convert from say PICBASIC to Swordfish.
need to do some looking at the similarities like POKE and PAUSE
PAUSE in swordfish? I think is delayms()
I think I see what be80be was talking about, learning PICBASIC
 

be80be

Well-Known Member
Swordfish doesn't have pusin pusout. That's what i miss the most . I have PIC BASIC PRO now the full version now. But now I like swordfish a little better Swordfish is lot like C. MrDeb assembly is not that hard and you can see what happening.Yes you write more of it but that's mostly delay code or math code or tables.

Mr Deb I would stay with one language learn it well and forget about the rest.
 
Last edited:

MrDEB

Well-Known Member
thats what I am trying to do

I bought the books hoping to get a better understanding of whats going on.
Looking at the examples in the pic basic book I can see similarities between swordfish and picbasic
going to try and get a better handle on swordfish while using picbasic as a guide line so to speak.
learn program flow etc.
 

be80be

Well-Known Member
MrDeb this is all you need to think about with swordfish learn how to write basic for all
six states and you'll be on your way to happy coding
 

Attachments

MrDEB

Well-Known Member
thats one way to put it

now to implement it.
thinking how to scan 8 pushbuttons for electronic organ or go with ADC using a resister matrix.
 

be80be

Well-Known Member
I have code you can use for the 8 buttons if you want it
You can use more it for a keypad i had it playing 12 notes on like a organ
 
Last edited:
Status
Not open for further replies.

EE World Online Articles

Loading
Top