Author Topic: Coding help  (Read 5321 times)

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Coding help
« on: September 10, 2011, 12:10:43 PM »
So ive been trying to learn assembly recently.. im not very good at it as i only know some simple instructions. I want to get the chip to read a switch and then turn an led on or something. Ive tried like a million times trying o get the chip to read the switch. ive  used peices from bmu to try. ive even copy/pasted the code for switches from the gooligum electronics page. nothing seems to work. i know its not the switch as i tested it using t0ps led chaser code. anybody wanna give me a hand and help me out? 

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline hyper999

  • Acidmods Alumni
  • Millennium Poster
  • *
  • Posts: 1158
  • Post quality +544/-3
  • Research and Development
Re: Coding help
« Reply #1 on: September 10, 2011, 01:13:33 PM »
Show us your best attempt? I would think its probably something to do with how you set up the port.

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Re: Coding help
« Reply #2 on: September 10, 2011, 04:24:15 PM »
well here it is... i noticed that it does the button press when i tap the wire... not the switch...
« Last Edit: September 10, 2011, 04:30:28 PM by drummerdude »

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline Hazer

  • x4675636B4E7574
  • Acidmods Alumni
  • Acid Modder
  • *
  • Posts: 583
  • Post quality +59/-0
Re: Coding help
« Reply #3 on: September 10, 2011, 04:46:36 PM »
OK.

First, you are using pin 5 as the input, but you do not use the weak pull ups. You will have to use a resistor on pin 5 to pull it up or else the button wont work correctly.

Second, you call your delay10 routine that moves the value in the work register to setup how many times the outer loop loops. The last value you had in thier was 60 from setting up the TRIS register, so it would loop for 0.6 seconds before continuing. You need to put a value into your dc3 register in the routine (like a value of 1).

Third, you never change the default ANSEL register to turn the analog function off. Although pin 5 is does not share an analog function, the pin you are using as an output (pin 0) does share an analog function and you need to change the ANSEL register to make the pins digital.

Fourth, putting a value of 15 for your delay routine will flash the output so fast you would never see it, it would just simply be dim. You need a value of 100.
[Quote from Gamermodz via Viking forums]
Don't be jealous your not half as smart. I hate ****tards like you. An ignorant redneck. Your nothing but a posing ******. Get the **** out of here, really, your claim to fame is an open source rapid fire code? You make me laugh. You think you have control over the modding market?  You couldn't create what I can and do. You are too ignorant with your outrageous assumptions and accusations. [/Quote]

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Re: Coding help
« Reply #4 on: September 10, 2011, 07:11:28 PM »
Ha! Ha! I took your advice and it works! Thanks a lot!

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline Nevbox

  • Granny Spanker
  • *
  • Posts: 356
  • Post quality +12/-5
Re: Coding help
« Reply #5 on: September 11, 2011, 03:43:25 AM »
you really need to go through all the tuts on Googligum, I have been through about 4 of them and they are really useful, it takes time but it pays off :)

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Re: Coding help
« Reply #6 on: September 11, 2011, 01:52:48 PM »
So i made an led color changer last night when i go my problem fixed... i know its kinda unnecessary since there's already 3 of them made, but i just wanted to make my own.. anyway here it is..
http://www.youtube.com/watch?v=r3J45eTnBQ0

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline Rodent

  • XBOX,XBOX360,PS3,WII
  • Acidmods Alumni
  • Around the block
  • *
  • Posts: 2983
  • Post quality +75/-5
  • Gender: Male
  • MODDER, REPAIR, CUSTOM IDEAS.
Re: Coding help
« Reply #7 on: September 11, 2011, 01:55:03 PM »
Nice work coming along good there . hope i can keep up with the competition ;)

 Tracey: I cant believe Rodent of all people made my damn day
3D0: snacks cartoons and naps  lol sounds like rodents typcial day :rofl:
Rodent consoles mods

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Re: Coding help
« Reply #8 on: September 15, 2011, 06:34:43 PM »
So im working on an abxy flasher type code... So the code works fine until you get to the last mode.. after the last mode, its soppost to go back to off, but instead it doesnt... not really sure whats going on, jus like i said before, i dont know exactly what im doin... lol... mabe someone could take a look at it and tell me whats wrong possibly...

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline hyper999

  • Acidmods Alumni
  • Millennium Poster
  • *
  • Posts: 1158
  • Post quality +544/-3
  • Research and Development
Re: Coding help
« Reply #9 on: September 16, 2011, 08:36:10 AM »
At a glance there is problems with your test routines.

- test2 which is called from the end of the chase mode only leads to chase or blink not off, I believe this to be why your code won't go back to the off mode

- also test and test2 should not be "called" or how you have them currently will cause the call stack to overflow after you change mode a few times, because you call them but then if the button is pressed a return instruction is never given. I would change "call test" to "goto test" then replace the return at the end of test with "goto blink" (you will also need to change test 2) this will stop the stack overflowing.

Also I noticed these, they aren't stopping it from working but they aren't helping

- You are controlling the LEDs directly in your main loop, it would be better to set up a timer interrupt then have the main routine deal with the button reads and current mode and tell the interrupt what to do using flags registers.

- when reading the button whilst in the last 2 modes you don't de-bounce the button reads nor do you wait for it to be released before continuing.

Sorry i'm not too good at explaining stuff so if you don't get any of that let me know :P

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Re: Coding help
« Reply #10 on: September 16, 2011, 04:16:43 PM »
So i remember i changed it to goto somewhere instead off goto off, since i wanted to see if it worked from a different label
I also changed my calls to gotos.. and i changed the tests to this..
test
   btfss   GPIO, 4
   call   debounce
   btfsc   GPIO, 4
   goto   chase
   goto   Blink   
test2
   btfss   GPIO, 4
   call   debounce
   btfsc   GPIO, 4
   goto   off
   goto   chase

and it still didnt work... and its even worse now.. it just toggles an led on and off and doesnt do any modes... not sure what happened...

id like to know how to write an interrupt also.. ive read about them, but ive never written one before.. but id like to get to that once i an get this to work..

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Re: Coding help
« Reply #11 on: September 17, 2011, 11:38:29 AM »
Yay! my 0603 leds came in today! so i can attempt to do the 7mode color mod! I love my led provider... they arent the chepest prices but they have fast shipping, usually they only give me 1 extra led, but ive bought from them countless
times now so they gave me 4 xtra leds! also i still didnt get my code fixed either.

edit: ive been looking for batteries for the last half an hour and i cant find any... so much for doing that mod today
« Last Edit: September 17, 2011, 12:53:40 PM by drummerdude »

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Re: Coding help
« Reply #12 on: September 20, 2011, 12:49:06 PM »
So ive been thinkin bout the code today, and if you change the call to gotos and then have goto blink or whatever, then it will just keep on repeating the 1 instruction and wont do the whole thing... is there like a return for gotos or something i can do to counteract this?

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Re: Coding help
« Reply #13 on: September 20, 2011, 01:28:20 PM »
OMG, so i decided to have multiple different button tests for each mode and each test brought you 2 the next instruction, and it worked! i just tested the code and it worked pretty much fine, although i did have 2 press the switch a second time 2 get it to change. so if you wanna look at it and maybe help me out with something, idk, here it is.

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Re: Coding help
« Reply #14 on: September 25, 2011, 01:41:12 PM »
this is my final ABXY flasher code. Now its time to move on to the next code...

http://www.youtube.com/watch?v=yfD3osp5-NU

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline hyper999

  • Acidmods Alumni
  • Millennium Poster
  • *
  • Posts: 1158
  • Post quality +544/-3
  • Research and Development
Re: Coding help
« Reply #15 on: September 25, 2011, 02:10:41 PM »
Thats awesome man! well done for actually completing something :D

Offline drummerdude

  • BST BAN
  • ♥ Poker Champ ♠♣
  • *
  • Posts: 237
  • Post quality +11/-5
  • Gender: Male
  • Acidmods User
Re: Coding help
« Reply #16 on: September 25, 2011, 03:20:13 PM »
Thanks a lot! I worked really hard on it. thanks for all the help too.

"I'm not a very tall person, however I show self-confidence of a bigger person"

Offline Rodent

  • XBOX,XBOX360,PS3,WII
  • Acidmods Alumni
  • Around the block
  • *
  • Posts: 2983
  • Post quality +75/-5
  • Gender: Male
  • MODDER, REPAIR, CUSTOM IDEAS.
Re: Coding help
« Reply #17 on: September 25, 2011, 04:01:41 PM »
Thats awesome man! well done for actually completing something :D
Wow thats awsome I agree, with hyper also , nice job Congrates on such anice flasher :)

 Tracey: I cant believe Rodent of all people made my damn day
3D0: snacks cartoons and naps  lol sounds like rodents typcial day :rofl:
Rodent consoles mods

 

SMF spam blocked by CleanTalk
SimplePortal 2.3.5 © 2008-2012, SimplePortal