# pic programming help

Status
Not open for further replies.

#### williB

##### New Member
i shall try that..

#### williB

##### New Member
it worked very very well
the program is a lot smaller now. lol
only three lines are needed ?
this is very cool.. 8) 8)
oh , yes i am outputting the code from the switch.. :wink:

#### Nigel Goodwin

##### Super Moderator
williB said:
it worked very very well
the program is a lot smaller now. lol
only three lines are needed ?
this is very cool.. 8) 8)
oh , yes i am outputting the code from the switch.. :wink:

Sometimes life can be nice and simple :lol:

#### williB

##### New Member
well i coppied your stepper board Nigel,
after four hours all i have is a vibrating stepper motor.
lol i'm using a stepper made by Minebea Co., Ltd type 23KM-K379-G1
i am using the four flip flops from the programmer to drive four IFR-510 N channel mosfets set up like you have it & the diodes of course.
i havnt figured wether i should turn off one line before turning on the next
* sigh*

#### Nigel Goodwin

##### Super Moderator
williB said:
well i coppied your stepper board Nigel,
after four hours all i have is a vibrating stepper motor.
lol i'm using a stepper made by Minebea Co., Ltd type 23KM-K379-G1
i am using the four flip flops from the programmer to drive four IFR-510 N channel mosfets set up like you have it & the diodes of course.
i havnt figured wether i should turn off one line before turning on the next
* sigh*

You need to turn them on in the correct sequence, 1, 2, 3, 4 for full step mode - only one should ever be on at a time (for full step mode).

#### williB

##### New Member
Got it going ..
the transistors were not turning on all the way so i used a 74HCT04 and a varible power supply to boost the voltage to 6 Volts..It works so good that i can hardly keep it from turning .. perfect for a robot..
so i guess this is my next project. i have allways wanted to build a robot.
Pic controlled of course.

#### williB

##### New Member
nigel where can i find the list/definitions of the error messages from mpasm ?

#### williB

##### New Member
Nigel or anyone ...what is $+2 in this code ?? this is from the second LED flashing program.. Code: Delay movlw d'250' ;delay 250 ms (4 MHz clock) movwf count1 d1 movlw 0xC7 movwf counta movlw 0x01 movwf countb Delay_0 decfsz counta, f goto$+2
decfsz	countb, f
goto	Delay_0

decfsz	count1	,f
goto	d1
retlw	0x00

end

#### Exo

williB said:
Nigel or anyone ...what is $+2 in this code ??$ stands for the current address. So 'GOTO $+2' will jump 2 lines forward. #### williB ##### New Member Exo said: williB said: Nigel or anyone ...what is$ +2 in this code ??

$stands for the current address. So 'GOTO$+2' will jump 2 lines forward.
thanks
at first i thought it was a label...

#### Nigel Goodwin

##### Super Moderator
It's all explained in the MPASM helpfile, you really should try reading it!.

#### williB

##### New Member
i really should...

#### williB

##### New Member
Nigel ,the veroboard you use .. i am not familiar with it..

what do you mean when you say cut the tracks..?
are the connections running vertically down the board ..??

Oh nice to see the new chips supported..
i hope to see an analog data aquisition system up soon...kidding...

#### Nigel Goodwin

##### Super Moderator
williB said:
Nigel ,the veroboard you use .. i am not familiar with it..

what do you mean when you say cut the tracks..?
are the connections running vertically down the board ..??

Yes, the tracks are running vertically in that picture, Veroboard is a trade name (presumably the original inventor of the board?), it's also known as stripboard. You cut the tracks with a special tool called a 'spot face cutter', or you can use a small drill in your fingers :lol:

#### techknow

##### New Member
help wanted

hello guys..after a long time without any post...i am back again..hehehe

i need a very simple asm code for the below:
when porta ..RA0,RA1,RA2 AND RA3 gets an 4bit binary value it should save on an variable(any variable) and it will call to a data tabe and the value should go to portb.
Example: when porta gets 0x03h it call datatable after saving it on an variable and port be shoud get out put as..b'00000100'
when porta gets 0x05h portbshould get as ..b'00010000'
like this it goes ...so can any one help me..
i need an very simple code..

#### Nigel Goodwin

##### Super Moderator
Re: help wanted

techknow said:
hello guys..after a long time without any post...i am back again..hehehe

i need a very simple asm code for the below:
when porta ..RA0,RA1,RA2 AND RA3 gets an 4bit binary value it should save on an variable(any variable) and it will call to a data tabe and the value should go to portb.
Example: when porta gets 0x03h it call datatable after saving it on an variable and port be shoud get out put as..b'00000100'
when porta gets 0x05h portbshould get as ..b'00010000'
like this it goes ...so can any one help me..
i need an very simple code..

This is an extremely simple task!, you should be able to write it yourself, just a port read, a lookup table, and a port write. The lookup table needs to be 16 words long, and I would recommend using ANDLW b'00001111' after the port read to make sure the index value is no larger than 15.

#### techknow

##### New Member
helpppp

Code:
   	bsf 	STATUS,RP0
movlw 	b'00000000'
movwf 	LEDTRIS
movlw	b'00001111'
movwf	trisa
bcf	STATUS,RP0
clrf	LEDPORT

movwf	porta
movf	porta, f
movwf	count
movf	count, w
call	Table
movwf	LEDPORT
clrf	count
goto	Start

retlw	b'00000000'
retlw   b'00000001'
retlw   b'00000010'
retlw   b'00000011'
retlw   b'00000100'
retlw   b'00000101'
retlw   b'00000110'
retlw   b'00000111'
retlw   b'00001000'
retlw   b'00001001'
retlw   b'00001010'
retlw   b'00001011'
retlw   b'00001100'
retlw   b'00001101'

return
end

here the code i am using is this will work

#### Nigel Goodwin

##### Super Moderator
Re: helpppp

techknow said:
Code:
   	bsf 	STATUS,RP0
movlw 	b'00000000'
movwf 	LEDTRIS
movlw	b'00001111'
movwf	trisa
bcf	STATUS,RP0
clrf	LEDPORT

movf	porta, w ;changed
call	Table
movwf	LEDPORT
goto	Start

Table ANDLW b'00001111' ;added - ESSENTIAL!
retlw	  b'00000000'
retlw   b'00000001'
retlw   b'00000010'
retlw   b'00000011'
retlw   b'00000100'
retlw   b'00000101'
retlw   b'00000110'
retlw   b'00000111'
retlw   b'00001000'
retlw   b'00001001'
retlw   b'00001010'
retlw   b'00001011'
retlw   b'00001100'
retlw   b'00001101'

end

here the code i am using is this will work

I would suggest modifying it as I have in your listing.

You don't need to move W to a register, unless you want to use it elsewhere (which you obviously didn't, as you cleared it).

Status
Not open for further replies.

Replies
5
Views
980
Replies
12
Views
3K
Replies
4
Views
895
Replies
6
Views
1K
Replies
12
Views
4K