Author Topic: CODE HELP! Need to know which numbers correspond to each pin on a 12f683  (Read 6415 times)

Offline h311jump3r

  • Fart Sniffer
  • *
  • Posts: 41
  • Post quality +0/-0
  • Gender: Male
    • SparkMods - The Mod Repository
*EDIT* I actually just need to know the addresses of the ports and the bits cuz I cant find this info anywhere...a link or something would help (or you can just tell me)
*EDIT* I figured out the names of each pin on the chip in BASIC and not assembly.

Hi there anyone...lol.

Anyways, what I really need to know is what name/code corresponds to each pin in a 12f683 if my layout is gonna be like this. (1 = open (high) 0 = closed (low))

                                                                                       
                              ______
 (1?) Power->     1 -|         |- 8   <-Ground  (0?)           
                         2 -| CHIP  |- 7         
(0) leftTrigger->  3 -|         |- 6    <-Right Trigger (0)       
                         4 -|_____ |- 5                                   
                                                                                         
                                                         
                  *idk what to do with the power (pin 1) and the Ground (pin 8). I know how to set the pins to in or out but I don't know how to show to what pin. Basically I'm not sure what name they would have in an asmembly program. The coding is probably going to be the hard also but first I need to know this...I need to know when/how to send a pulse to both right and left triggers (pins 3 & 6). I can do that with something like...

*my constants are wrong because I do not know how to set which pin for input output and stuff because I dont know what they are called. Basically...I want 1,0,0,0,0,0,0,0,0

*So...basically...the only one that is an input is the power (if it needs to be input?) then the rest are jsut output (to send the signals). What I ahve now is 02h for the 00000 (Idk what pins that is for tho!) and 00h (same thing). Just help me out...

;Our Constants

STATUS  equ  03h                              ;Address of the STATUS register
TRISA     equ  85h                              ;Address of the tristate register for port A
PORTA    equ  05h                              ;Address of Port A
COUNT1  equ  08h                              ;First counter for our delay loops
COUNT2  equ  09h                              ;Second counter for our delay loops

Start            movlw              02h               ;send the signal by putting it
                   movwf             PORTA           ;into the w register and then on the port

;****the delay

          call Delay

;****Delay finished, now turn signal off****

movlw  00h
movwf  PORTA

call Delay

goto Start
         
;****Our subroutine

Delay

Loop1          decfsz              COUNT1,1     ;This second loop keeps the signal
                  goto                 Loop1          ;turned off to
                  decfsz              COUNT2,1     ;
                  goto                 Loop1          ;
return

;****End of the program****

end                                                         
                               




lol...this is my first time ever programming anything...so help me out...                                       
                                                                     
« Last Edit: August 06, 2008, 08:38:51 PM by h311jump3r »

Offline Hazer

  • x4675636B4E7574
  • Acidmods Alumni
  • Acid Modder
  • *
  • Posts: 583
  • Post quality +59/-0
First, the datasheet is here:  http://ww1.microchip.com/downloads/en/DeviceDoc/41211D_.pdf

Second, a 'PICs for dummies' tutorial is here:  http://web.tampabay.rr.com/hazer/Introduction.htm

Thirdly: You do not have to define the chips ports. They are already defined in the include file. You can find it in the MPLABS folder. Your assembly should have a line near the begining like this:

Code: [Select]
list      p=16f88           ; list directive to define processor
#include <p16F88.inc>        ; processor specific variable definitions

You would then write to each pin individually using BSF or BCF instructions like so:

BSF   PORTA, 0  ;set pin 0 on PORTA.


or you can write to the entire port:

movlw   0x01        ; move the binary value b'00000001' to work register
movwf   PORTA     ; move value rfrom work register to PORTA.

That would clear all bits except pin 0.

[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 h311jump3r

  • Fart Sniffer
  • *
  • Posts: 41
  • Post quality +0/-0
  • Gender: Male
    • SparkMods - The Mod Repository
Ok...I decided not to go with asembly with this. So I reverted to basic (which is way more easier). I think I have it down except now I need to know how to detect a button press (e.g. the ir scanner above the select button on the 360 controller) then start the rapid fire sequence. I have about a page of code right now taht I am not going to release because it could affect kingmike's sales and stuff if someone just changed those values and stuff.

right now I got the rapidfire to do 27-29 button presses to left and right triggers. I have some code that should let it know when the Ir scanner button is pressed...then start the rapidfire.

*I haven't gotten my chips or programmer yet so I can't tell.

Here is the code to see if the button is pressed (not sure if this will work though):

Edit: I used "symbol button = GPIO.5" to make "button" represent GPIO.5

Code: [Select]
if button = 1 then          ' wait till button is pressed
  goto StartRapidFire         ' to start the rapid fire
      else
      goto Main

that and this to make the GP5 into an input

Code: [Select]
TRISIO = %00100000            ' GPIO.5 input (IR scanner button on 360)

so, please respond if any of you can help. Thanks
« Last Edit: August 06, 2008, 08:36:40 PM by h311jump3r »

Offline PspKicks316

  • Acidmods Alumni
  • Mad Bomber
  • *
  • Posts: 5709
  • Post quality +5/-4
  • Gender: Male
So all you're doing is trying to replicate and jack off Mikes code.

And what? IR scanner? What the heck are you talking about? The SYNC button?

Oh,never used BASIC before. Lol..

Offline h311jump3r

  • Fart Sniffer
  • *
  • Posts: 41
  • Post quality +0/-0
  • Gender: Male
    • SparkMods - The Mod Repository
dude...Im making this for myself. This is my first time ever coding anything and I just want to learn this crap because later on in life I want to be an Aerospace engineer. And if creating your own code without a programmer or compiler or anything like that means copying someone elses work....then...im not sure what I am doing then  :psp:. It not my fault that he knows more than me. It would be more helpful if kingmike helped me. I sent him a PM but he neva replied... :help:

Also, I have the basics for this code to work...It just that I don't have a compiler to check it with. The one I have doesn't even understand this:

Code: [Select]
delay_ms = 500                      'wait till pic stable

input button
  if button = 1 then                ' wait till button is pressed
    goto StartRapidFire               ' to start the rapid fire
      else                          ' 0 means no connection to pin right???
        goto CheckButton

Give me errors and crap about delay (saying I need to put delay( 500 ) (which i'm not sure if it is BASIC))

Offline Hazer

  • x4675636B4E7574
  • Acidmods Alumni
  • Acid Modder
  • *
  • Posts: 583
  • Post quality +59/-0
Dont be put off by KingMike. This subject is very sensitive for him as apparently his code has been ripped off by others. He gets alot of people asking him for code everyday and he is probably getting a bit put-off by it.

As for coding in Basic, I cant help you. It greatly depends on what software you are going to use. My suggestion is that you first find the software and learn it. Otherwise you are just scribbling non-sense as all the definitions of PIC code are determined by the software.

But do not get discouraged, keep it up. Just know that you should start learning all the steps instead of just jumping into the middle.
[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 everlasting_will

  • ♪♪♪ Tone deff ♪♪♪
  • *
  • Posts: 74
  • Post quality +0/-0
  • Gender: Male
    • BEPSP
Well, i am not sure what is all this about, i guess rapidfire for the xbox controller isn't it? Well i could help but i would need to know a little about the hardware of the controller. I guess the button in which you want to make rapidfire is formed by two parts, i guess one is ground and the other a positive voltage.I am also assuming that when you press the button the positive part is bridged with ground (through a resistive component like in the psp) but if i am wrong in something let me know.
If i were you i would use the mplab ide with the hi-tech universal toolsuit which provides a compiler for c source codes. Go to the microchip website, download the mplab ide and the instalation wizard will ask you about installing the hi-tech so accept it.
Then tell me a little about the hardware of the triggers and i will help you writting the code.
By the way i have made an overview of the pic's datasheet and i have also realized that you are using in you assembly code the GPIOs 4 and 1 as ouputs, be careful! this pic seems to have an analog to digital converter module and those pins can be used for that purpose. By default the pic has the register ANSEL=0xFF which means they are configured as analog channels, you will need to at least set this register ANSEL=0x00 for setting it as digital I/Os (also you would have to be careful with the configuration of the comparator module).
Well post some hardware info and i will help you asap.
First Be then PSP !!


Offline h311jump3r

  • Fart Sniffer
  • *
  • Posts: 41
  • Post quality +0/-0
  • Gender: Male
    • SparkMods - The Mod Repository
sorry for the wait:

I ordered 6 chips, 3 samples or the 12f683 and 12f675 from microchip.

I am not using any resistors, just the chip, wires and the "sync" button of the xbox 360 controller. Im going to assume this:

when the sync button is pressed, it creates a current (signal). and when this happens, this tells the chip to send output signals from 2 other pins (not power or ground pins) to the left and right trigger POTs. This will make the controller fire...rapid fire.

But...the thing is, I don't know how to code something that says:

if 'sync button' is pressed, then 'start rapid fire' (a subroutine)

inside the subroutine there is another if command:

if button is pressed, then goto start/main/check button status.


Once I get that and how to send pulses after the button is pressed then I will be done.

Im sorry if this post doesn't include a lot of info, but...I hope you get the point.

Plz help out...btw...what compiler does kingmike use...does he code in basic, c, or asm? :)

Offline everlasting_will

  • ♪♪♪ Tone deff ♪♪♪
  • *
  • Posts: 74
  • Post quality +0/-0
  • Gender: Male
    • BEPSP
sorry for the wait:

I ordered 6 chips, 3 samples or the 12f683 and 12f675 from microchip.

I am not using any resistors, just the chip, wires and the "sync" button of the xbox 360 controller. Im going to assume this:

when the sync button is pressed, it creates a current (signal). and when this happens, this tells the chip to send output signals from 2 other pins (not power or ground pins) to the left and right trigger POTs. This will make the controller fire...rapid fire.

But...the thing is, I don't know how to code something that says:

if 'sync button' is pressed, then 'start rapid fire' (a subroutine)

inside the subroutine there is another if command:

if button is pressed, then goto start/main/check button status.


Once I get that and how to send pulses after the button is pressed then I will be done.

Im sorry if this post doesn't include a lot of info, but...I hope you get the point.

Plz help out...btw...what compiler does kingmike use...does he code in basic, c, or asm? :)
Well, it would be needed to know what possitive voltage has the buttons, and what happens when a button is pressed. In the PSP for example when you press a button you are bridging (joining) a positive voltage to ground. So the PSP is always reading this possitive voltage and only when it is ground detects a pressing. If i assume that you have soldiered one of the pins of the MCU to the sync button, and also that when this buttons is pressed, this point carries 5volts everything would be very easy. You would just have to set the MCU with this pin as digital input and lunch a subrutine when set at high level.
Why do you have to send signals to both triggers?
Also i don't have any idea about who is kingmike and therefore no idea what language does he use for coding. I can tell you that MPLAB IDE is the official tool (including IDE, compilers, linkers,etc) for programming PICs (from microchip) and that HI-TECH software is a company that has good tools (and very famous) for programming in c language either with the MPLAB IDE or with its own IDE based on eclipse called HI-TIDE.
In c for example to catch a high level input at GPIO0 is as simple as:
void initiate_rapidfire(void);
if (GPIO0=1)
{
    initiate_rapidfire();     
}
If you want initiate_rapidfire to stopped when the sync button is pressed another time:
void initiate_rapidfire(void)
{
    while(GPIO0)
    {
             //rapidfire routine 
    }
}

This would be the core of the program. There would be need to add some configuration intructions and little more. The simplest way for doing the rapidfire would be to send high voltage signals or low voltage, depending on the hardware and then makin a delay for example with the predefined function delay_us(unsigned char us) or delay_ms(unsigned char ms) i guess that would be enough with the delay_ms (miliseconds) because dalying just a few microseconds could be quite funny ;).
Well as i told you i need to know more about hardware, i need to know this:
-Which two parts of the board are joined when the triggers and the sync buttons are pressed (separately).
-Which voltage has those two parts on each button or at least if any of the two parts for each button is the general ground of the controller.
-If you can send me a picture of the board of the controller where i can see the effect of a pressing button. And also would be good an indication of the pint in the board which you are planning to feed (the power) of the MCU.
« Last Edit: August 10, 2008, 06:46:00 PM by everlasting_will »
First Be then PSP !!


 

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