Pages: [1]   Go Down
Author Topic: add new function to wiring_digital.c  (Read 5795 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!
I am trying to add new function "MydigitalWrite" to wiring_digital.c () (\arduino-0017\hardware\cores\arduino)

When I try to compile:
In function 'void loop()':
error: 'MydigitalWrite' was not declared in this scope

How to win this problem?



Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!
Quote
I am trying to add new function "MydigitalWrite" to wiring_digital.c () (\arduino-0017\hardware\cores\arduino)

When I try to compile:
In function 'void loop()':
error: 'MydigitalWrite' was not declared in this scope

How to win this problem?

There should be no reason to modify the core function in the wiring library.

Just write your new function directly following the loop() function in your sketch:

void MydigitalWrite( int argument1, int argument2, etc.)
 {
   //your new code
   // more code
 }

Then you can use your new function anywhere in the setup or loop function of your sketch.

Lefty
« Last Edit: January 22, 2011, 02:06:42 pm by retrolefty » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

there is one reason
standart digitalwrite spends a lot of time to switch on or switch of massive of pins
i think i can do it, if i modify standart digitalWrite
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 199
Posts: 12768
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Why do you want to modify digitalWrite?  To make it faster?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No. i want create new to switch on or off massive of pins
i cant use like this
Code:
for(int i=0;i<10;i++)
{
digitalWrite(i,HIGH);
}
because it spend a lot of time
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i only need add new function to \arduino-0017\hardware\cores\arduinowiring_digital.c
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 199
Posts: 12768
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
No. i want create new to switch on or off massive of pins
Have you considered direct port access?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes but i found nothing
How i can do it? there is special function?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i want to do it like this

Code:
     
out = portOutputRegister(port);
if (val == LOW) *out &= ~bit;
      else *out |= bit;
that is why i need to add new function
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 199
Posts: 12768
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Yes but i found nothing
http://www.google.com/search?q=arduino+port

Quote
How i can do it? there is special function?
http://www.arduino.cc/en/Reference/PortManipulation
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you
Logged

Pages: [1]   Go Up
Jump to: