E/X-Mag Microcontroller Programming (Atmel AT90S2313)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LorneCash
    Got XMOD? www.NiedTech.com
    • Aug 2005
    • 365

    #46
    Bit-Wizard:
    thanks a lot for the help on timers i managed to figure them out and used the Timer/Counters on the chip with interrupts to acomplish my tasks.
    Last edited by LorneCash; 11-24-2005, 02:27 AM.

    Comment

    • LorneCash
      Got XMOD? www.NiedTech.com
      • Aug 2005
      • 365

      #47
      Miscue,

      I am trying to make a semi auto mode but i can't seem to figure out how to eliminate a full auto/burst. I know one of the possibilities is that the polarity on the solenoid has to be changed. Is there an easy way to check this to verify it is wrong? what were the other causes that you encountered? I thought I read somewhere that you originally had three full auto bugs. I added a d-bounce loop and that eliminated most of them but it still happens sometimes may be every 100 to 150 shots.

      Comment

      • LorneCash
        Got XMOD? www.NiedTech.com
        • Aug 2005
        • 365

        #48
        Strings

        My Bigest problem at now is the display. I got it to work but I don't know how to make it output from a string. I have to write it character by character. I talked to my microprocessors professor and he wasn't much help this time. Although he did use agilent displays, all the displays he used were smart displays... All he could tell me is that (in my best paraphrase) if I give a string of characters to the controller it can convert them to ASCII but that i will have to use an offset or pointer or something, here's where i get confused, to assign the charmap to the ASCII number.

        Can someone explain how this is done in as much detail as possible? A few code samples would be good too so i get the syntax correct.

        Comment

        • Miscue
          Super Moderator

          • Oct 2000
          • 7105

          #49
          Originally posted by LorneCash
          Miscue,

          I am trying to make a semi auto mode but i can't seem to figure out how to eliminate a full auto/burst. I know one of the possibilities is that the polarity on the solenoid has to be changed. Is there an easy way to check this to verify it is wrong? what were the other causes that you encountered? I thought I read somewhere that you originally had three full auto bugs. I added a d-bounce loop and that eliminated most of them but it still happens sometimes may be every 100 to 150 shots.
          Does it shoot extra shots while the trigger is pulled or released? Adjust your trigger conservatively to rule out mechanical trigger bounce.

          Comment

          • Miscue
            Super Moderator

            • Oct 2000
            • 7105

            #50
            Originally posted by LorneCash
            My Bigest problem at now is the display. I got it to work but I don't know how to make it output from a string. I have to write it character by character. I talked to my microprocessors professor and he wasn't much help this time. Although he did use agilent displays, all the displays he used were smart displays... All he could tell me is that (in my best paraphrase) if I give a string of characters to the controller it can convert them to ASCII but that i will have to use an offset or pointer or something, here's where i get confused, to assign the charmap to the ASCII number.

            Can someone explain how this is done in as much detail as possible? A few code samples would be good too so i get the syntax correct.
            I don't understand... if you can write it character by character, then it's just a matter of creating a repeat loop outputting characters until you reach a NULL string termination character.

            You adjust your offset pointer... that points to your char bitmaps... based off the ASCII values.

            Pseudocode:

            Put next character in the string into MyChar
            (MyChar - 65) * (Byte size of bitmap character) = Desired offset for char bitmap

            Note: 65 is ASCII for 'A'. 'A' - 65 = 0... an offset of 0 is needed to get to the head of the char bitmap array. I'm assuming that the first character in your char bitmap is 'A'. Otherwise you'll have to change it from 65 to something appropriate.
            Last edited by Miscue; 11-29-2005, 06:46 PM.

            Comment

            • OmniM
              Registered User
              • Apr 2004
              • 555

              #51
              PM me, need a lil story from ya
              Proud owner of #VV04026

              MY WORK - X-MAGs Around the World Are you one among the Lucky Ones? - [X-Mag EXCELS]

              Comment

              • LorneCash
                Got XMOD? www.NiedTech.com
                • Aug 2005
                • 365

                #52
                Originally posted by Miscue
                Does it shoot extra shots while the trigger is pulled or released? Adjust your trigger conservatively to rule out mechanical trigger bounce.

                Yea, you're right, the gun i'm using for this project i bougnt on eBay and have never actually played with. when i loaded 3.2 on it, it bounced there too in e mode i think that's because of the trigger rod not being adjusted properly, but either way can you tell me how to check if the solenoid is wired backwards?

                Comment

                • bit-wizard
                  Registered User
                  • May 2005
                  • 205

                  #53
                  I don't think I understand your question about the solenoid being wired backwards. Solenoids are simply many turns of wire around a tube that the plunger rides in. When the solenoid is energized, the plunger is pulled into the tube. When it is de-energized, a spring returns it to its original position. Depending on how it is mechanically designed, this action can provide either a push or a pull from the plunger. The one in the emag looks like it should pull into the solenoid body when it is energized, pulling down on the sear. With all that said, most solenoids work the same way regardless of which direction the current is flowing. So you can't really have it in backwards unless there is an external circuit element like a diode in the current path preventing the current from flowing in one direction. The fact that it works for you most of the time indicates that it is wired correctly. Sorry if I missed the jist of your quetion -- if that's not what you were asking, please re-phrase.

                  Thanks,
                  bit-wizard

                  Comment

                  • Miscue
                    Super Moderator

                    • Oct 2000
                    • 7105

                    #54
                    Originally posted by bit-wizard
                    I don't think I understand your question about the solenoid being wired backwards. Solenoids are simply many turns of wire around a tube that the plunger rides in. When the solenoid is energized, the plunger is pulled into the tube. When it is de-energized, a spring returns it to its original position. Depending on how it is mechanically designed, this action can provide either a push or a pull from the plunger. The one in the emag looks like it should pull into the solenoid body when it is energized, pulling down on the sear. With all that said, most solenoids work the same way regardless of which direction the current is flowing. So you can't really have it in backwards unless there is an external circuit element like a diode in the current path preventing the current from flowing in one direction. The fact that it works for you most of the time indicates that it is wired correctly. Sorry if I missed the jist of your quetion -- if that's not what you were asking, please re-phrase.

                    Thanks,
                    bit-wizard
                    Here is the problem. The solenoid also creates a magnetic field - an opposite pole depending on how it is wired.

                    The EMag uses a magnetic HES sensor to detect trigger pulls. The solenoid is close enough to interfere with this. I've screwed around with this A LOT. It is well within the field... even relocating the HES/solenoid a pretty good distance further doesn't fix it, nor magnetic shielding. BTW... if you ever wondered what the difference was between 4.20 and 4.01 - it's a fix for this. Took me a while to understand what was happening.

                    If it is going FA when the trigger is released... then the solenoid is registering a trigger pull in place of the trigger magnet. With shot buffering, this can result in perpetual FA.

                    If it is going FA when the trigger is pulled... it is canceling the trigger magnet... so even though the trigger is pulled, the solenoid cancels the field temporarily. So: Trigger pull, solenoid cancels field and appears to not be pulled... solenoid powers down... trigger has not moved but a new trigger pull has been detected. = semi-perpetual FA because it doesn't consistently defeat the trigger magnet.

                    The first one I mentioned is sometimes referred to as the "4.x FA problem." The second is the "3.x FA problem," and is "fixed" by flipping the solenoid wires. However, the 3.x software also has the "4.x FA problem," it's just harder to reproduce... 4.x magnifies it big time.

                    4.20 solves both problems... At least, I was unable to find a counter-example... it cured a lot of really bad FA EMags.
                    Last edited by Miscue; 11-26-2005, 03:22 PM.

                    Comment

                    • LorneCash
                      Got XMOD? www.NiedTech.com
                      • Aug 2005
                      • 365

                      #55
                      Dwell

                      Kind of off the subject but how did 30ms become the magic number for solenoid dwell? Is there any research results for different dwell times that i could see? If it's somewhere else on AO can someone copy and paste it into this thread. I think it would make sense to post it here. I thought i read somewhere that it was 25ms in other some software versions.

                      Also, what is the recommended time to advance the warp feed without firing the gun?

                      Comment

                      • Miscue
                        Super Moderator

                        • Oct 2000
                        • 7105

                        #56
                        Originally posted by LorneCash
                        Kind of off the subject but how did 30ms become the magic number for solenoid dwell? Is there any research results for different dwell times that i could see? If it's somewhere else on AO can someone copy and paste it into this thread. I think it would make sense to post it here. I thought i read somewhere that it was 25ms in other some software versions.

                        Also, what is the recommended time to advance the warp feed without firing the gun?
                        These values were determined by Tom Kaye/AGD... the amount of time needed for the bolt to reliably make a full stroke.

                        You can prime the warp by turning on the solenoid for a fraction of a millisecond.

                        Comment

                        • LorneCash
                          Got XMOD? www.NiedTech.com
                          • Aug 2005
                          • 365

                          #57
                          Low battery FA bug

                          I've just discovered the low battery FA bug in my software. Does swaping the solenoid wires fix that or was that fix done in the software?

                          Comment

                          • Miscue
                            Super Moderator

                            • Oct 2000
                            • 7105

                            #58
                            Originally posted by LorneCash
                            I've just discovered the low battery FA bug in my software. Does swaping the solenoid wires fix that or was that fix done in the software?
                            Did you try this with the marker aired up? When you get the low battery FA condition, it does not have enough power to pull the solenoid... as far as I remember.

                            Makes you feel all warm and fuzzy don't it.

                            Also... if I remember correctly... the problem is that the solenoid draws too much power in low battery condition... dropping the voltage below normal operational levels. The HES isn't a passive kind of switch... it requires power to work right... insufficient voltage = the HES does not output correctly... and you get FA. Don't quote me on that... I tested this situation with a different kind of switch but do not remember the results.

                            I also tried... to make the gun not fire when it detects low voltage. However, this does not work right... it screws things up... semi-random behavior... not shooting when supposed to... when the marker has normal power. Seems that the solenoid drops it to low voltage condition all the time... even if the battery isn't low.

                            BTW... this post... although short... represents many... many hours of work... to come to these conclusions. Also... many hours wondering to myself... "Why isn't there a well-placed capacitor? Taiwan makes them pretty cheap."
                            Last edited by Miscue; 11-29-2005, 07:08 PM.

                            Comment

                            • LorneCash
                              Got XMOD? www.NiedTech.com
                              • Aug 2005
                              • 365

                              #59
                              Display

                              I think my problem with the display may be that i don't know where in memory my CHRMAP: is being saved.

                              I define it like this:

                              CHARMAP: .DB 0x00,0x00,0x00,0x00,0x00,0x7C,0x8A,0x92,0xA2,0x7C ; " ",0
                              .DB 0x02,0x42,0xFE,0x02,0x02,0x46,0x8A,0x92,0x92,0x62 ; 1,2
                              .DB 0x44,0x82,0x92,0x92,0x6C,0x18,0x28,0x48,0xFE,0x08 ; 3,4
                              .DB 0xE4,0xA2,0xA2,0xA2,0x9C,0x3C,0x52,0x92,0x92,0x0C ; 5,6
                              .DB 0x80,0x8E,0x90,0xA0,0xC0,0x6C,0x92,0x92,0x92,0x6C ; 7,8
                              ...

                              How do I give it a specific start location in memory so i know what the offset should be? Or is that the wrong approach?

                              Comment

                              • LorneCash
                                Got XMOD? www.NiedTech.com
                                • Aug 2005
                                • 365

                                #60
                                Display 2

                                I used to define my text strings like this:

                                M_TRUE: .DB SPACE,SPACE,SPACE,SPACE,SPACE,SPACE,BLOCK,BLOCK,0x ff,0xff

                                notice the "0xff" at the end of the row... I was using that to tell the loop it is at the end of the string. Is there a better way to do this so I can just define my strings like this:

                                M_TRUE: .DB "MY TEXT"

                                (Also see my previous post)

                                Comment

                                Working...