I need your help (MPGuino code change for Arduino mega 2560?)
In MPGuino V0.86 entries for the injector and VSS Pins are made with these,
injector open D2 (int0) injector closed D3 (int1) speed C0 (pcint8) I needed to change the code of these Pins, so that work in Arduino mega 2560, which has D2 as (int4) and D3 as (INT5) and C0 there is no pcint8. What parts should I change the code and how should I do. Thank you José Rodrigues |
find:
#define RISING 3 #define FALLING 2 These into whatever interruptpins you are using. find: #define vssBit ( 1 << 0 ) 0 into whatever analog pin you are using. |
Quote:
Later I will post here the changes I made and a video with the result. Thank you José Rodrigues |
Not changed the (# define RISING 3) (# define FALLING 2), because I use the pin 2 and 3, which amends and the INT0 and INT1, which belongs to pins 20 and 21.
Part code of injectors. Code:
injectorSettleTime = injhold; Or put the value of the pin? The pin that I use is the "A8" which uses pin "62" on the arduino mega. If you have something wrong, please correct me. As shown in the video, the program starts fine, but then when I trigger any of the buttons does a reset type, do not know what causes it. https://www.youtube.com/watch?v=_oFHlihGZog If I can help I thank José Rodrigues |
Quote:
Code:
#define vssBit (1 << PINC0) Quote:
|
Quote:
mpguino_alt3_ino:251: error: 'PINK11' was not declared in this scope mpguino_alt3_ino:251: error: 'PINK12' was not declared in this scope mpguino_alt3_ino:251: error: 'PINK13' was not declared in this scope mpguino_alt3_ino.ino: In function 'void __vector_10()': mpguino_alt3_ino:398: error: 'PINK8' was not declared in this scope mpguino_alt3_ino.ino: In function 'void mainloop()': mpguino_alt3_ino:577: error: 'PINK11' was not declared in this scope mpguino_alt3_ino:577: error: 'PINK13' was not declared in this scope mpguino_alt3_ino:584: error: 'PINK12' was not declared in this scope mpguino_alt3_ino:608: error: 'PINK11' was not declared in this scope mpguino_alt3_ino:608: error: 'PINK12' was not declared in this scope mpguino_alt3_ino:608: error: 'PINK13' was not declared in this scope mpguino_alt3_ino:613: error: 'PINK11' was not declared in this scope mpguino_alt3_ino:613: error: 'PINK12' was not declared in this scope mpguino_alt3_ino:613: error: 'PINK13' was not declared in this scope mpguino_alt3_ino.ino: In function 'void editParm(byte)': mpguino_alt3_ino:1368: error: 'PINK11' was not declared in this scope mpguino_alt3_ino:1368: error: 'PINK13' was not declared in this scope mpguino_alt3_ino:1379: error: 'PINK12' was not declared in this scope mpguino_alt3_ino:1407: error: 'PINK11' was not declared in this scope mpguino_alt3_ino:1407: error: 'PINK12' was not declared in this scope mpguino_alt3_ino:1407: error: 'PINK13' was not declared in this scope mpguino_alt3_ino:1412: error: 'PINK11' was not declared in this scope mpguino_alt3_ino:1412: error: 'PINK12' was not declared in this scope mpguino_alt3_ino:1412: error: 'PINK13' was not declared in this scope Here is a picture to help with the mega pins. http://imageshack.us/a/img826/1596/l293.th.jpg Thank you José Rodrigues |
PinK? :)
|
Quote:
http://imageshack.us/a/img826/1596/l293.th.jpg |
The error above was my mistake, define, # define vssBit (1 << PINK8); # define lbuttonBit (1 << PINK11); # define mbuttonBit (1 << PINK12); # define rbuttonBit (1 << pink13), but these pins is not are the correct, the correct are# define vssBit (1 << PINK0); # define lbuttonBit (1 << pink3); # define mbuttonBit (1 << PINK4); # define rbuttonBit (1 << PINK5), the K Pins are 0 to 7.
I've been a bit sleep. But even with these changes, the problem remains. Will be a registration on the changes I made, what needs to be changed too? Any registration that points to a different Pin. Thank you José Rodrigues |
Can you give us a list of the interrupt vectors you're using? Such as -
Code:
ISR( TIMER2_OVF_vect ) { // system timer interrupt handler It turns out that the Arduino compiler would blindly accept anything placed within the "ISR()" parentheses. For my serial output ISR, I could have written: Code:
ISR( this_is_not_defined_vect ) { // serial UART transmit data ready vector The reason that is important is because if Arduino does not have the actual interrupt vector that is found in interrupts.h (mentioned near the beginning of the MPGuino code), then whatever is inside the ISR() parentheses will default to interrupt vector 0. That happens to be the processor reset vector. |
Quote:
Code:
ISR(TIMER2_OVF_vect) José Rodrigues |
I think the problem is the injector pins, together with the interruptions. I've been doing some more experiments in the code of the injectors, and did not do a reset, but the image did not change the lcd, even By pressing the buttons.
Thank you José Rodrigues |
I've been looking on the internet and found that the Timer2 in atmega 328 controls with pins 3 and 11, and with the mega, pins 9 and 10.
Is that the problem I have? What is the advice you give, change the Timer2 or change the pins and keep the Timer2. In the mega, the Timer0 and Timer2 are 8bits as the atmega 328, and the rest are 16bit. To change the timer and keep 8bits, could only be with Timer0, which somewhat limits the options, I think the best is to change the pins and keep the Timer2. What is your opinion regarding this issue. Note: Pins that are occupied on my arduino mega are 13 and 11, the remaining PWM are free, I changed the lcd for Pins PA0, PA1, PA2, PA3, PA4 and PA5 Pins that are 22, 23, 24 , 25, 26 and 27. Thank you José Rodrigues |
Quote:
As to whether it's causing your continual resets... That's a good question. Only thing I can suggest is to keep on finding the spots in the MPGuino code that are hardware dependent, and change them. That, and keep good notes. Quote:
Quote:
|
I've been checking the Timer2 perishes not be related to the INT0 and INT1, but with the PWM pins OC1A and OC2B.
If I understand correctly, the Timer2, control the Pins 3 and 11, but as PWM output. Please correct me if I'm wrong. Quote:
Thank you José Rodrigues |
Quote:
|
I apologize for the mistake, not the pin 3 and 9 but 3 and 11.
Quote:
The statement 3 and 11, is that recorded on board the arduino uno, so does the pins 9 and 10 of the Arduino Mega, once again I apologize for the confusion, I usually use the sheets with pinout of pighixxx.com , and this is reason to use that number and not the actual number of pins of the atmega chip. This information was gathered from this site: Arduino 101: Timers and Interrupts | Let's Make Robots! I leave here also the image of the pinout atmega 328 I use http://www.pighixxx.com/pgdev/Temp/A...Pinout_Web.png Might be useful to someone Thank you José Rodrigues |
How do you have your LCD hooked up to your Mega?
|
Quote:
Thank you José Rodrigues |
All times are GMT -4. The time now is 06:35 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com