Acidmods

AcidMods Resources ----- ( These are helpful tools for modding ) => Pic Programmers and Programs => Software => Topic started by: SYSTEM aka (Cyberpyrot) on March 22, 2008, 04:54:44 PM

Title: Code for 4 Mode Switch
Post by: SYSTEM aka (Cyberpyrot) on March 22, 2008, 04:54:44 PM
Code is in pic Basic Pro it is a rough code and will get better with time we just want to show you we are working.. With this chip you can use the note button to control all sorts of led combonations.. Lord Nico also has the code in assembly and will be posting a POC soon. Lord Nico's Poc will be inside a psp



Keep in mind we are planning to get these boards made super tiny with SMD componants this is just my proto typing board for coding..

the modes are as follow

Mode 1:
hold button down for 5 seconds turns led one on.

Mode 2:
Hold button down for 5 seconds turns led one off and turns led 2 on.

Mode 3:
Hold button down for 5 seconds turns led one on and turns led 3 on.

Mode 4:
Turns all leds off.

Quote
x VAR BYTE
y VAR BYTE
i VAR BYTE
TRISB = 0 'Set PortB to outputs.

 
x = 0: y = 0:i = 0

start:

IF PORTA.1 = 0 Then Pause 500
IF PORTA.1 = 0 Then mode
GoTo start

mode:
i = i + 1
IF i = 5 Then i = 1 ' reset to 1

GoSub blink

IF i = 1 Then 'Light White LED
PORTB.0 = 0: PORTB.1 = 1: PORTB.2 = 0
EndIF

IF i = 2 Then 'Light Green LED
PORTB.0 = 1: PORTB.1 = 0: PORTB.2 = 0
EndIF

IF i = 3 Then 'Light Red and White LED
PORTB.0 = 0: PORTB.1 = 1: PORTB.2 = 1
EndIF

IF i = 4 Then 'All Leds off
PORTB.0 = 0: PORTB.1 = 0: PORTB.2 = 0
EndIF


GoTo start

blink:
PORTB.2 = 0
For y = 1 TO i
Toggle PORTB.2
Pause 500
Toggle PORTB.2
Pause 500
Next
Return
Title: Re: Code for 4 Mode Switch
Post by: zbblanton on March 22, 2008, 10:03:22 PM
is basic pro the some as basic?
Title: Re: Code for 4 Mode Switch
Post by: P3nnyw1se on March 22, 2008, 10:20:23 PM
looks good
Title: Re: Code for 4 Mode Switch
Post by: tibor28 on March 25, 2008, 04:12:49 AM
looks cool, just got a noobish question, how do you actually get your source code programmed into the chip? do you somehow connect it to pc or what? :confused:
Title: Re: Code for 4 Mode Switch
Post by: SYSTEM aka (Cyberpyrot) on March 25, 2008, 04:30:59 AM
looks cool, just got a noobish question, how do you actually get your source code programmed into the chip? do you somehow connect it to pc or what? :confused:

yes you need a microcontroller programmer.
Title: Re: Code for 4 Mode Switch
Post by: everlasting_will on April 18, 2008, 07:49:13 AM
Man! That is all the code? Well i don't know anything about basic pro but it seems quite simple, quite intuitive. Is that all the necessary code for using the pic as four switches, is that the only thing needed to be written into the PIC?
I had a look at Lord Nico's assembly code and pffff, not very easy. Well in any case i will try to program the PIC's on "C" language. The thing that afraid me the most is the coding lines like for example when programming the PSP you have to say if you are in user mode or in kernel mode, like you have to enter some protocol lines in order that the program will work properly. It seemed like Lord Nico had some configuration lines but your program haven't. Well i don't even know if you are using the same PIC so i don't know if that big difference is just because of the assembly or also due to some differences on the PIC's.
Man i just can't wait to have my programmer.
Title: Re: Code for 4 Mode Switch
Post by: SYSTEM aka (Cyberpyrot) on April 27, 2008, 04:57:22 PM
Man! That is all the code? Well i don't know anything about basic pro but it seems quite simple, quite intuitive. Is that all the necessary code for using the pic as four switches, is that the only thing needed to be written into the PIC?
I had a look at Lord Nico's assembly code and pffff, not very easy. Well in any case i will try to program the PIC's on "C" language. The thing that afraid me the most is the coding lines like for example when programming the PSP you have to say if you are in user mode or in kernel mode, like you have to enter some protocol lines in order that the program will work properly. It seemed like Lord Nico had some configuration lines but your program haven't. Well i don't even know if you are using the same PIC so i don't know if that big difference is just because of the assembly or also due to some differences on the PIC's.
Man i just can't wait to have my programmer.

LOL pic basic pro converts that to Hex..
SimplePortal 2.3.5 © 2008-2012, SimplePortal