Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: attachInterrupt use within a library question on: December 18, 2013, 11:30:54 am
Thanks for the replies PaulS & Majenko,

Majenko, your site makes reference to a "Change Notification library", but I can't seem to see it listed, is it available to have a look at?

I'll have a work through the code + your explanations this evening, thanks again both of you,
2  Using Arduino / Programming Questions / Re: Simple Headlight Control Code on: December 18, 2013, 02:25:15 am
Instead of using delay which essentially stops the microprocessor from running any further code you may wish to use a millis() function and allow the program to loop until the correct delay period has been reached

I presume your arduino has a number of inputs and outputs and you may wish to use these to do something else

If your microprocessor is only doing one thing then you may consider later you wish to get it to do something else and the delay function will not allow parallel operation until delay has completed the delay
 
3  Using Arduino / Programming Questions / attachInterrupt use within a library question on: December 17, 2013, 07:12:54 pm
hello, newbie question (I have searched google + arduino forums but do't understand the responses, and am stuck).

Can someone please explain the use of attachInterrupt, especially with regards to the ISR within a library.   I have tried various things, and keep having errors of various flavours being provided, thanks in advance.

basically I am trying to write a class to enable various pins on the Arduino DUE , and within which I have tried to setup interrupts to call a few ISR's when the interrupts occur.

I am basically trying to calculate the time elapsed between pulses from a variable reluctance sensor (via an LM1815)

I have tried a few different variants now, but the code within the class is essentially the following:
Code:
attachInterrupt(_1VRSenPin, Update1VR, CHANGE);

the code within the ISR function is essentially:
Code:
void Inputs::Update1VR(){
   TimeNow = micros();
  if( TimeNow > 1VRSenTimeOld)
   {
   1VRSenDT = TimeNow - 1VRSenTimeOld ;
   1VRSenTimeOld = TimeNow;
   }
   else
   {
   1VRSenTimeOld = TimeNow; // if you're wondering this is the one way I thought
// I could deal with timer micros() overflow, given I don't expect much variance
// from one VR pulse to the next because of inertia in the object I'm measuring.
   }

Can someone please explain to a newbie the use of the ISR function within a library?

I've looked at a few libraries that contain interrupts now and just cannot seem to understand the ISR bit, I've tried it as it's function within the library and within the class and I'm still having errors thrown up.
4  Products / Arduino Due / Re: Due GUI (Graphical user interface) - [now version 0.13] on: October 16, 2013, 02:05:27 pm
cowasaki

can i ask how the dash is going.  I am very interested in your project as I'm sure many others are.

Would be great to see the inclusion of some guages (rev counter type) within the library

Rob
5  Products / Arduino Due / PROGMEM on Due, working with Flash on: March 19, 2013, 08:19:00 am
Hello,

Firstly I apologise if this is covered elsewhere in the Due forum, I have tried to search but found nothing specific to the Due and the use of PROGMEM with the Due and working with flash.

Does PROGMEM http://playground.arduino.cc/Main/PROGMEM work on the Due, given that the pgmspace.h library http://www.nongnu.org/avr-libc/user-manual/group__avr__pgmspace.html seems to require #include <avr/io.h>?

http://www.oreilly.de/catalog/arduinockbkger/Arduino_Kochbuch_englKap_17.pdf

Is there another way to store values directly into and work with flash memory on the Due?

What I'm looking to do is to:
1) start the Due with an initial setpoint.
2) update / send a revised setpoint from another device using CAN BUS, serial etc.
3) update the initial setpoint in the due, so that should I remove the power from the due, under restart, or power up it uses the revised setpoint stored in flash memory that replaced the original setpoint value.

Thanks for your thoughts in advance

Rob
6  Products / Arduino Due / Re: Timer Interrupts on Due on: March 11, 2013, 07:22:31 pm
This may be off topic, but is it possible to modify the library to be able to measure pulse duration on a pin using the timer interrupts?

Many thanks for your time in advance

Kind regards Rob
7  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: March 11, 2013, 07:10:49 pm
AdderD, thank you very much, perfect explanation, just what I was looking for, I'm a whole lot clearer on the MAMx, and MIDx registers.  The SAM manual appears to have errors in it.

Looking at table 41.9.15, Can Message Acceptance Mask Register (CAN_MAMx), the table below refers to MIDvA & MIDvB.... which is actually the table for 41.9.16, Can Message ID Register (CAN_MIDx).

Palliser, thanks for your help, I'm basically looking to use SAE J1939 as the PGN arrangement seems to offer everything I'm looking for to be able to transmit quite a bit of multiple sensor / input data in a single CAN message.

The following file may be of interest to someone : http://gurtam.com/files/ftp/CAN/j1939-71.pdf.

Many thanks to both of you again,
8  Products / Arduino Due / Re: [ now published on github ] Building a CAN API for Arduino DUE on: March 09, 2013, 08:13:22 pm
Hello all, firstly may I please apologise if this appears to be a daft question, I am new to Arduino Can Bus on the Due.

I've had a look at the examples given and the library and the SAM manual section 41.7.2.1, but I'm at a loss to understand how to setup the Due to receive ALL messages regardless of id.

Or if it was setup to receive SAE J1939 messages (29 bit messages) that uses a 3 bit priority, then a 18 bit Parameter Group Number (PGN), and then an 8 bit source address for the message.  The PGN allows for destination specific communication and broadcast communication.  How to set it up to receive a range or all PGN messages or a bank of PGN messages.

Thanks for your time & advice in advance.

Rob
9  Products / Arduino Due / Re: Building a CAN communication protocol interface for Arduino DUE on: February 01, 2013, 07:17:58 pm
Palliser,

the 120k resistor is positioned to the left hand side of the end of bus jumper pins (between the CANL & CANH markings on the Waveshare board).



Thanks very much for your points regarding ultra-low sleep current mode, and the filter & buffer capacitors, i'll defiantly keep it in mind and can see the advantages of the 234 over the 230.

With regards to "pin 8 (Rs) is been underused and fixed to ground (high-speed mode)", looking at the datasheet for the 230 (link below), I don't think that this module / interface board is actually set for full high speed mode, as it has a 10k resistor before the ground connection, and reading the datasheet, this seems to imply that it is actually set up in slope control mode (pg 20 of datasheet) as ~ 15V/usec, does this not imply that it is actually not in full high speed mode?  But I may have misunderstood the datasheet (is slew rate not related to the bus frequency?)

http://www.ti.com/lit/ds/symlink/sn65hvd230.pdf

Many thanks again,

regards Rob
10  Products / Arduino Due / Re: Building a CAN communication protocol interface for Arduino DUE on: February 01, 2013, 04:08:51 pm
Hello all, firstly I am new to Arduino, but am eager with the anticipation of Canbus for the Due as it will serve my application well.

While I can understand why some of you may require a shield to provide easy connectivity with a Canbus interface and the arduino due, could I ask what would be wrong with using something such as the below link for a canbus  development module that appears to be quite cost effective to me + my application?  I presume it would still work with the upcoming Due library?

SN65HVD230 CAN Board Network Transceiver Evaluation Development Module Kit 3.3V
http://dx.com/p/sn65hvd230-can-board-network-transceiver-evaluation-development-module-150782
http://www.wvshare.com/product/SN65HVD230-CAN-Board.htm

To those developing the canbus library, keep up the good work, your efforts will very much be appreciated I'm sure as it will bring the simplicity of the other numerous other libraries to this very capable processor.

(not to be pushy, but do we have a timeline of when we may see a beta library, or an initial issue?)

Thanks in advance
Rob
Pages: [1]