caramoan tour package

caramoan tour package

Author Topic: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...  (Read 706 times)

Offline jubric

  • CR2032 Battery
  • **
  • Posts: 20
  • Pogi/Ganda Points: 0
HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« on: September 19, 2010, 10:39:34 AM »
Good day everyone! at ELAB...

Patulong naman about PIC programming using assembly...
Im stil a newbie in pic,i jst want to know kung pano icode yung pic na magrerecieve ng combinational inputs through portA then iactivate nya ang particular output sa portB...

for example: input aq ng combination ng high sa RA0,RA2,RA4 then ang corresponding function or output nya ay maactivate high ang RB5...

gamit ko po ung PIC16f84a as slave microcontroller ng arduino board ko...kasi kulang na ang I/O pins ang arduino ko eh...

Sana meron maka respond...Thanks... :)

Philippine Electronics Forum

HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« on: September 19, 2010, 10:39:34 AM »

Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3032
  • Pogi/Ganda Points: 208
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #1 on: September 19, 2010, 11:14:01 AM »
Kailangan ba assembly?  Mas madali yan kung basic or c ang gamitin mo.  Libre naman ang hitech C lite sa mplab.

Philippine Electronics Forum

Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #1 on: September 19, 2010, 11:14:01 AM »

Offline jubric

  • CR2032 Battery
  • **
  • Posts: 20
  • Pogi/Ganda Points: 0
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #2 on: September 19, 2010, 11:24:12 AM »
assembly po kasi pinapagamit sa project namin eh...pwede po kau magbigay ng sample code with comments?

Philippine Electronics Forum

Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #2 on: September 19, 2010, 11:24:12 AM »

Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3032
  • Pogi/Ganda Points: 208
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #3 on: September 19, 2010, 11:32:39 AM »
i-google mo na lang  .....  madami nagkalat sa net

Philippine Electronics Forum

Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #3 on: September 19, 2010, 11:32:39 AM »

Offline travian19

  • Size AA Battery
  • ****
  • Posts: 127
  • Pogi/Ganda Points: 8
  • Gender: Male
  • due to the resistance of....
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #4 on: September 19, 2010, 12:11:59 PM »
Walang magbibigay sayo dito ng sample codes. Newbie din kc ako, sa datasheet lang din ako nagbabase, assembly nga din ginagamit namin. Mgsearch kna lang, kng may error sa program mo ska mo ipost at skaling may tumulong n. Suggestion lang po
ctrl+alt+del "restart your brain!"

Philippine Electronics Forum

Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #4 on: September 19, 2010, 12:11:59 PM »

Offline Kaizer03

  • Nuclear Reactor
  • ****
  • Posts: 4847
  • Pogi/Ganda Points: 225
  • C#<-->Android<-->Java
    • PhilRobotics
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #5 on: September 19, 2010, 12:13:49 PM »
Just to give you hint:



you can use lookup table for here...

RETLW k


the returned value will be move in PORTB..


say you will have all your PORTA as your input..

Code: [Select]
movf PORTA, 0 ; Move the value of PORTA in W
call table  ; Call Table routine
MOVWF PORTB ; store the returned value in PORTB


table
  ADDWF PCL, F
  RETLW  <value here>
  RETLW  <value here>
  RETLW  <value here>
  RETLW  <value here>
  RETLW  <value here>


this is just a sample lookup table, but it will vary depends on your needs
Lend a hand for those who are in need!=)

Stop Hijacking!=) More Technical Posts!=)
 ;)

Kaizer Killer EX Pre-Alpha

Offline jubric

  • CR2032 Battery
  • **
  • Posts: 20
  • Pogi/Ganda Points: 0
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #6 on: September 19, 2010, 12:28:20 PM »
Salamat po sa mga response ninyo... cge po try kong gawin mga suggestions ninyo...
sir kaizer thanks sa hint...ireresearch ko nalng yang lookup table...
soon il be posting the assembly code...
if i hav problems i hope matulungan nyo din po aq...
thanks po ulit...cge po til nxt tym...

signing off.

Offline Kaizer03

  • Nuclear Reactor
  • ****
  • Posts: 4847
  • Pogi/Ganda Points: 225
  • C#<-->Android<-->Java
    • PhilRobotics
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #7 on: September 19, 2010, 12:32:31 PM »
Salamat po sa mga response ninyo... cge po try kong gawin mga suggestions ninyo...
sir kaizer thanks sa hint...ireresearch ko nalng yang lookup table...
soon il be posting the assembly code...
if i hav problems i hope matulungan nyo din po aq...
thanks po ulit...cge po til nxt tym...

signing off.


no problem, giving ideaa or hints wont hurt at all, atleast you will know where will you start studying/researching..

just keep on posting.... we can help you as long as you will help yourself to learn also.. =)


goodluck;)
Lend a hand for those who are in need!=)

Stop Hijacking!=) More Technical Posts!=)
 ;)

Kaizer Killer EX Pre-Alpha

Offline NanotecH

  • Lead Acid Battery
  • *******
  • Posts: 779
  • Pogi/Ganda Points: 44
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #8 on: September 19, 2010, 03:04:00 PM »
maraming way para mangyari ang gusto mo.

puedeng gamitan mo ng btfss:

Code: [Select]
repeat:                        ;start of input check
btfss PORTA, 0                 ;check RA0, skip if high or true
goto repeat                    ;go back to start if RA0 is zero or false
btfss PORTA, 2                 ;check RA2, skip if high or true
goto repeat
btfss PORTA, 4                 ;check RA4, skip if high or true
goto repeat
bsf PORTB, 5                   ;set RB5 high

or puede ring:

Code: [Select]
repeat:
movf PORTA, W               ;move value of PORTA to W register
xorlw 15H                   ;compare 15H to the value of W register
btfsc STATUS, Z             ;check if Zero bit of STATUS register is zero or false
bsf PORTB, 5
goto repeat

idea lang yan, hindi kumpleto.  baguhin mo na lang para maging angkop sa gusto mong mangyari.
220V/10A input = 220V/30A output...Fact or Fiction?  Myth or Reality?
One word is enough for a wise man.
"Never tell the truth to people who are not worthy of it." - Mark Twain

Offline jubric

  • CR2032 Battery
  • **
  • Posts: 20
  • Pogi/Ganda Points: 0
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #9 on: September 23, 2010, 05:19:21 PM »
Just to give you hint:



you can use lookup table for here...

RETLW k


the returned value will be move in PORTB..


say you will have all your PORTA as your input..

Code: [Select]
movf PORTA, 0 ; Move the value of PORTA in W
call table  ; Call Table routine
MOVWF PORTB ; store the returned value in PORTB


table
  ADDWF PCL, F
  RETLW  <value here>
  RETLW  <value here>
  RETLW  <value here>
  RETLW  <value here>
  RETLW  <value here>


this is just a sample lookup table, but it will vary depends on your needs


Gud day po Sir Kaizer..pwede po malaman kung ano ung algorithm na pwede ko gamitin base sa binigay mo na codes??..

para san po ung mga values sa lookup table?..un po ba ung outputs na ipapasa sa portb or inputs po un sa para sa porta?

Offline Kaizer03

  • Nuclear Reactor
  • ****
  • Posts: 4847
  • Pogi/Ganda Points: 225
  • C#<-->Android<-->Java
    • PhilRobotics
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #10 on: September 23, 2010, 06:19:53 PM »
^

based on my code above..

assuming PORTA has a value of 2...

then it will move in to W register.. then it will call the table..

the current Value of W Register will Add to the Program Counter(PCL) and will move towards the Series of RETLW depending on the Value which came from PORTA..

then it will return the corresponding literal value you have stated back to the "last" table call.. the return value is stored in W register so that after returning from the table you have to stored it in PORTB to send the Output into it..

hope that helps you..

need to go home for now.. =)
Lend a hand for those who are in need!=)

Stop Hijacking!=) More Technical Posts!=)
 ;)

Kaizer Killer EX Pre-Alpha

Offline jubric

  • CR2032 Battery
  • **
  • Posts: 20
  • Pogi/Ganda Points: 0
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #11 on: September 24, 2010, 03:45:54 PM »
Thanks po sir kaize
^

based on my code above..

assuming PORTA has a value of 2...

then it will move in to W register.. then it will call the table..

the current Value of W Register will Add to the Program Counter(PCL) and will move towards the Series of RETLW depending on the Value which came from PORTA..

then it will return the corresponding literal value you have stated back to the "last" table call.. the return value is stored in W register so that after returning from the table you have to stored it in PORTB to send the Output into it..

hope that helps you..

need to go home for now.. =)


Thanks po sir kaizer..nakuha ko na ang concept...so lets say if i have a combinational binary inputs on porta pins = 00010 this means its equal to 2 in decimal...then sa look up table magmomove xa sa 2nd retlw then ung values nun ipapasa nya sa portb pins...correct me if im wrong sir kazier...

Offline Kaizer03

  • Nuclear Reactor
  • ****
  • Posts: 4847
  • Pogi/Ganda Points: 225
  • C#<-->Android<-->Java
    • PhilRobotics
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #12 on: September 24, 2010, 04:16:31 PM »
^

yup.. but consider the zero value.. so it will return the 3rd RETLW instead...

NOTE: the W will add to the PCL corresponds on its next line..

ADDWF PCL, f  ; PCL + 2
RETLW 0 ; + 0
RETLW 1 ; + 1
RETLW 2 ; + 2 
RETLW 3
Lend a hand for those who are in need!=)

Stop Hijacking!=) More Technical Posts!=)
 ;)

Kaizer Killer EX Pre-Alpha

Offline jubric

  • CR2032 Battery
  • **
  • Posts: 20
  • Pogi/Ganda Points: 0
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #13 on: September 29, 2010, 02:49:17 PM »
Gud day po kay sir kaizer..

nakuha ko na po ung codes base sa lookuptable...

at nagpatulong na lng din po ako sa lab facilitator namin na magaling din sa assembly..


Thanks po for helping me out...pogipoints++ for you!... :)

Offline Kaizer03

  • Nuclear Reactor
  • ****
  • Posts: 4847
  • Pogi/Ganda Points: 225
  • C#<-->Android<-->Java
    • PhilRobotics
Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #14 on: September 29, 2010, 09:48:39 PM »
Gud day po kay sir kaizer..

nakuha ko na po ung codes base sa lookuptable...

at nagpatulong na lng din po ako sa lab facilitator namin na magaling din sa assembly..


Thanks po for helping me out...pogipoints++ for you!... :)


good to hear that..

thanks sa points=)

just here to help =)
Lend a hand for those who are in need!=)

Stop Hijacking!=) More Technical Posts!=)
 ;)

Kaizer Killer EX Pre-Alpha

Philippine Electronics Forum

Re: HELP PO MGA PIC EXPERTS...alam ko po kaya nu tong sagutin...
« Reply #14 on: September 29, 2010, 09:48:39 PM »

 

Privacy Policy

Contact Us: elabph@yahoo.com