Sei sulla pagina 1di 19

Arduino and Proview

Posted by marc - 2010/12/02 13:07 _____________________________________

MotionControl USB I/O is for me the "only" device which is standard in Proview. I am working in a technical school and my budget is low. At the moment I am in the learning curve of Proview and I wonder if there is somebody with succesfull small "low-budget device-projects" who wants to share their knowledge, for example with a Arduino. All suggestions are welcome... Regards, Marc
============================================================================

Re:Arduino and Proview


Posted by claes - 2010/12/05 15:50 _____________________________________

Hello Marc, I'm not familiar with Arduino, but at a quick glance it looks as it would be quite easy to connect it to Proview. I will order a board and check it out. Proview V4.8 has support for Velleman K8055 which is a low cost USB board suitable for educational applications. /Claes
============================================================================

Re:Arduino and Proview


Posted by marc - 2010/12/05 19:30 _____________________________________

Hi Claes, Holy Moly..., I just looked at thr release notes of 4.8.0. The Arduino has tons of projects and a huge comminity. In combination with the K8055 is it a great start to kick in the door from the educational system. And that's the place to be..... /Marc
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/02 12:23 _____________________________________

Hi Claes, I have found why/when the Arduino is slow. It's because of the Arduinos digitalWrite() command. The same problems with a analogWrite() which takes longer than the digitalWrite(). Because of simplicity the pins are labeled, by the makers of the Arduino, as digital 0-13 and analog 0-5. The ATMega chips pins are labeled differently. The trick seems to be to use true c style commands, what the AVR compiler uses.

void setup() { Serial.begin(9600); } void loop() { int initial = 0;


Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

int final = 0; initial = micros(); for(int i = 0; i < 500; i++) { digitalWrite(13,HIGH); digitalWrite(13,LOW); } final = micros(); Serial.print("Time for digitalWrite(): "); Serial.print(final-initial); Serial.println(""); initial = micros(); for(int i = 0; i < 500; i++) { PORTB = 0b00100000; PORTB = 0b00000000; } final = micros(); Serial.print("Time for true c command: "); Serial.print(final-initial); while(1); }

Off topic: The cheap balance system with a metal ball is still playing my mind...... If on the axis is a stepper and a potentiometer I can only see an undefined area (when the coils of the stepper are not activated) where the ball it can't win from the "friction"....
============================================================================

Re:Arduino and Proview


Posted by Snarf77 - 2011/05/02 14:56 _____________________________________

Hi Marc, I also already red this here: http://billgrundmann.wordpress.com/2009/03/03/to-use-or-not-use-writedigital/ but the pin address is then hard coded during compiling, isn't it ? do you think this can be used together with Proview as you need to re assign the pin number depending on your Channel Number in your project ? Snarf
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/02 15:50 _____________________________________

Hi Snarf, I am pretty dizzy after: http://www.billporter.info/ready-set-oscillate-the-fastest-way-to-change-arduino-pins/ and http://code.google.com/p/digitalwritefast/downloads/list So, I don't really know yet. But there is always hope..... /Marc
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

============================================================================

Re:Arduino and Proview


Posted by claes - 2011/05/03 09:43 _____________________________________

Even if a digitalWrite takes over 3 us, 20 digital outputs are not more than 60 us, and it's not much compared to the 4-5 ms which seems to be the shortest cylce time for the Proview communication sketch. Sending a few bytes with 115 000 baud shouldn't take more than 1 ms, so there is still 3 ms missing... /Claes Post edited by: claes, at: 2011/05/03 09:56
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/04 10:16 _____________________________________

Hi Claes, Lots of people are complaining about the slowness of the Arduino. Do you think it can be because inefficiency of the core libraries? /Marc
============================================================================

Re:Arduino and Proview


Posted by claes - 2011/05/05 18:52 _____________________________________

Hi Marc, The Proview skech uses the IO functions and the USB communication functions, and if you look at this thread the communication shouldn't be a problem. Maybe it has to with the way I have implemented the communication... http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1293624867 /Claes
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/05 23:48 _____________________________________

For Arduino Duemilanove & PROVIEW http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove Di Do 4 fix Ao and 4 fix Ai....

Hello Marc, So far nothing I've done with the Arduino, but like you I am not happy with the Arduino software for the reasons, that you already have said. My Env: Ubuntu 11.04 + Eclipse eclipse-cpp-helios-SR2-linux-gtk-x86_64 + AVR Eclipse Plugin
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

http://avr-eclipse.sourceforge.net/wiki/index.php/The_AVR_Eclipse_Plugin a. #apt-get install arduino ( will insall avr-gcc, avr-libc, avrdude ) b. Start Eclipse Put project into Eclipse workspace: Eclipse File Import Existin Project Into Workspase next Select a directory to search for existing Eclipse projects. browse select Project Edit code -> build To flash Arduino pwr Properties AVRDude New Programmer Hardware Arduino override ... port /dev/ttyUSB0 ? override baud rate 57600 OK AVR -> Upload Project to Target Device But, if You don't like to install Eclipse You can burn Arduino whit AVRdude only: /usr/bin/avrdude -pm328p -carduino -P/dev/ttyUSB0 -b57600 -Uflash:w:pwr.hex:a Post edited by: ivo1204, at: 2011/05/07 13:25
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/06 12:46 _____________________________________

Hi Ivo, Please, can you explain what you have done? Greetings, /Marc
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/06 20:34 _____________________________________

Hi Marc, Here is english rems http://www.proview.se/components/com_joomlaboard/uploaded/files/pwr.gz Post edited by: ivo1204, at: 2011/05/07 13:26
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/07 13:37 _____________________________________

Hi Marc, I test this version and everything work , so You can use / for UNO, not for mega / http://www.proview.se/components/com_joomlaboard/uploaded/files/pwr-275898a16a698256bfeb3640b5051b3d.gz Post edited by: ivo1204, at: 2011/05/07 13:38
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/07 13:46 _____________________________________
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

Hi Ivo, I haven't time this weekend but after a quick glance many questions are popping up. One of them is basically, am I skilled enough to follow you.....? Did you implement port manipulation for the Uno/mega328p, incl high serial communication? Greetings, /Marc
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/07 15:18 _____________________________________

Hi Marc, Everything is very simply because it is detailed described in the datasheet of atmega 328p actually serious chip. Your problem lies in the arduino software - a wonderful software which, however, has other goals. For example, when reading analog inputs Arduino start conversion and wait to read - and that is about 1600 CPU clocks. wiring_analog.c line 71 // start the conversion sbi(ADCSRA, ADSC);

// ADSC is cleared when the conversion finishes while (bit_is_set(ADCSRA, ADSC)); <= HERE !!! wait 1600 cloks... So you just have to try and avoid these things - nothing more. Baud rate is defined in config.h -> define BAUD 57600 ,/can be other/ only output analog signals are limited to 4, everything else should work. Arduino UNO and others with ATmega 238p should also work. Post edited by: ivo1204, at: 2011/05/07 15:21
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/07 20:16 _____________________________________

Hi Ivo, I am sitting here blinking a couple of times with my eyes. Thanks a lot, I haven't flashed an UNO yet but please tell me why it's limited to 4 PWM's..... By the way are you the colleague from Istvn? Greetings, /Marc
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/07 22:38 _____________________________________

Proview-Forum - Proview - Open Source Process Control

Joomlaboard Forum Component version: 1.1.4 Stable

Generated: 2 August, 2011, 16:03

Hi Marc, It is no problem at all PWM's to be 6, only have to check pins ... timer 1 is free I start Proview and arduino at 115200 baud rate wary well, but have to change code: in serial.c void Serial_begin() { ........ UCSR0A = 0 to => UCSR0A = (1<<U2X0); UBRR0H = xxxx to => UBRR0H = 0; UBRR0L = xxx to => UBRR0L = 16; ............

// DOUBLE SPEED // //

============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/08 00:35 _____________________________________

Hi Ivo, I have flashed a Duemilanove. I had some problems with avrdude. Can only flash with 19200 baud otherwise I get a sync error. I needed the force flag as well (running avrdude version 5.10). Proview (4.8.1-1) doesn't recognize the device (a project with 57600 baud and device /dev/ttyUSB0). Tomorrow I will give codeblocks/eclipse a try. Thanks again for your input. /Marc
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/08 15:15 _____________________________________

Hello Marc, Yesterday I did tests and saw that when I put Di stops working. In the code there is an error somewhere, but today I'm busy. Greetings Post edited by: ivo1204, at: 2011/05/08 15:16
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/08 18:42 _____________________________________

Hi Ivo, Take your time. It's very interested the way you want to speed up the Arduino in combination with Proview. I am for sure a couple of us will scratch their heads a couple of time after your posts. I hope you stay a while and don't disappear too quickly. My opinion is that the way Proview is build is a master piece and has incredible high potential. The community is relatively small and I really hope it can grow slowly and get the place in the world it deserves...... First I will try to read the ins and outs from the atmel data sheet. Because the steps you make are pretty big for me.
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

Regards, /Marc
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/11 00:28 _____________________________________

Hi Ivo, Holy Shot. This is driving me completely nuts. I flashed your latest pwr.hex to an UNO. I left the -b flag away otherwise it doesn't want to sync. I created a small project with only an Av and an Ao with a LED on a breadboard. Ao0 is pin 6 on the Arduino and it doesn't matter what kind of ChanAo number I configure in Proview. Only RX is active and it seems to be TX is on a holiday. My ActualValueRange 0-255 and when I give an actualvalue from 1000 in the running PLC the LED is just waking up. The datasheet and your code gives me the feeling why the hack I didnt choose to become a plumber and I can only see a smile on the face of my girlfriend when I look at her up-side-down. My dog is sitting, the last 2 hours, looking sad and shaking his head near the front door and my bloody school made the decision to roll windows 7 out and put more restrictions on the network. The brains cells I didn't kill in my life are running 9600 baud and I want to feel my pillow. And dream, just dream....... But I love it...... /M
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/12 18:15 _____________________________________

Hi Marc, I am a little busy these days, now I changed the code slightly, so I guess that would not have a problem with reading it. All signals are recorded and read from the arrays, so you have freedom to do anything with the data. Ao in the previous code I measured the multemetar and was a 0 to 5V. But anything is possible, the problem is right in some hardware incompatibility with timer 0 So now work - I test only Ai and Di 115200 / 57600 http://www.proview.se/components/com_joomlaboard/uploaded/files/pwrb3c1f241f059292fbe70b7f5c1fd559d.gz Post edited by: ivo1204, at: 2011/05/12 18:17
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/13 19:48 _____________________________________

Hi Ivo, I have a serial error in the last version. No RX/TX at all. Scratching again. Edit: I don't understand in main.c, function solve_message():
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

msgType == MSG_TYPE_WRITEALL and msgType == MSG_TYPE_READALL If Proview is sending, there are no messages WRITEALL and READALL as far as I know.

/Marc Post edited by: marc, at: 2011/05/13 22:26


============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/14 13:41 _____________________________________

Hi Marc, For the protocol of Proview I can only guess, based on source of pwr_arduino_uno.pde https://github.com/siamect/proview/blob/master/otherio/exp/rt/src/pwr_arduino_uno.pde and rt_io_m_arduino_uno.c https://github.com/siamect/proview/blob/master/otherio/lib/rt/src/rt_io_m_arduino_uno.c It has 'MSG_TYPE_WRITEALL' and 'MSG_TYPE_READALL'. It seems that we have to read both Ai + Di, or write Ao + Do, is used. Problem is that when Proview open connection, issued Reset signal to Arduino.Then control is taken by the bootloader, which reads the first byte. So we will always receive the first message wrong. Bootloader is an independent application and initialize the connection speed that is set. It is important for AVRDude and other programming programs, but nothing to do with Proview. That, your Arduino is programmed at 19,600 means that maybe you have an older version of bootloader. The first byte is very important for bootloader, depending on its content , it decided what to do. However, for Proview, it is only the length of the message, and it is variable. This is the first problem, and more - because the wrong speed USART registers are full of errors. So we need to reset connection and start a new one with new USART speed. USART speed has close connection AJA CPU clock.My Arduino is 16 Mhz and that speed is essential for calculating the value of registers UBRR0H and UBRR0L. If you think, it may be different in the atmega 328p datasheet is a table Table 19-5 ,6,7 (UBRR0H =0 ) .You can choose an appropriate speed with the smallest error. For example, at 250k 16Mhz, clock Error = 0.0%, but we have no such option. So I do not know what message must issue Arduino to make Proview to resend configuration. Another opportunity which I intend to try, to block a Reset signal. The best way is putting resistance between Reset and +5 V, but the value is very important, and must be as much as can in high. Is it somewhere in the Inernet is described. Maybe 1K you need check.No soldering, then put it into a socket Jxxx, this would solve many problems. Another resistor (Its value may be high - 10k and more) to pin 0 and +5 V would decide another bad problem. RX USART line must be 1 whenever there is no connection, level 0 means to start USART connection and synchronization. To use the internal resistor 328 is stupid, and all the time to establish port D bit 0 to 1 ...
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/14 14:10 _____________________________________

Hi Ivo,

Oeps...., I am sorry, the arduino sketch standard in Proview 4.8.1-2 is not the same as in the git. It seems to be Claes implemented 'MSG_TYPE_WRITEALL' and 'MSG_TYPE_READALL' in a later *.pde version. /Marc
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/14 16:02 _____________________________________

Hi Marc, It seems puting ........ if (num) { status = ARD__MSGSIZE; <============== HERE! msgSize = Serial_peek(); // read size of message. ................... in main.c work
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/14 17:03 _____________________________________

Hi Ivo, Can you upload your latest version and tell me which I/O's are working. I am complete lost. Thanks.... /Marc
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/14 17:27 _____________________________________

Hi Marc, Ao and A1 are block, Do and Ai work at 1ms 115 200 / You can put 57600,38400 ../ Config (size=10, id= 1): 50 2 0 16 2 0 32 1 3 0 Debug (id 12, size 10, type 7): 50 2 0 16 2 0 32 1 3 0 http://www.proview.se/components/com_joomlaboard/uploaded/files/pwr-bb1942d3fbe35a2dd6eaac8fa818de1f.gz For Di : pwr_func.c void readAll(){ ---// Read Digital inputs for ( i = 0; i < diSize; i++) amsg = Di & diMask; => for ( i = 0; i < diSize; i++) amsg = Di & diMask; -------Also working Ao2, Ao3 cannels, but for now there should be a Ao0 and Ao1, also in pwr_func.c in: aoWrite () and writeAll () Ao = msgData & aoMask ; = => Ao = msgData ; aoMask makes the output 0 On the Arduino pin 11 and 3 I measure from 0-5V analogue Ao outputs channels also must have a different number, eg 0,1,2,3
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

Post edited by: ivo1204, at: 2011/05/15 13:24


============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/15 22:22 _____________________________________

Hi Ivo, I just walked in.... Thanks for all your work and the steps you described. Tomorrow I will have a look and give your "Proview-Arduino-Turbo-Version" a try again. Don't forget to write your name/license in the header(s). It's your credit...... and you deserve it. /M
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/16 21:51 _____________________________________

step 1) cup of coffee..... step2) pwr-bb1942d3fbe35a2dd6eaac8fa818de1f.gz as is (no changes): pwr.hex --> avrdude -pm328p -carduino -P/dev/ttyACM0 -Uflash:w:pwr.hex:a Proview --> Ai0 --> LDR + 10k --> 115200 baud Ai0: Number 0 Rawvalue range 0 1023 ChannelSig ValRange 0 - 5 SensorSigValRange 0 -5 ActValRange 0 100 Number: (ADC0) => 23 pin, Arduino 0 Runtime.... RX/TX active...... nice.... LDR responding...., I am not going to check the values.... Great! Ivo! ------------------------------------------------------------Lets make a new Ai Ai1 Same settings as value settings as Ai0 (but pin 1) Same as Ai0, light dependent resistor..... Works perfect. -----------------------------------------------------------Step 3: Lets include a digital output..... I am not going to choose a combinated PWM so let's take Arduino pin 2. Don't get it working yet. Only RX active. ------------------------------------------------------------Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

Back to step 2 When I completely block out in pwr_func.c the function readAll() the Analog inputs (Aio and Ai1) are still working....(?) Post edited by: marc, at: 2011/05/17 21:18
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/18 12:59 _____________________________________

Hi Marc, Thanks for the comments. This is the version with corrections. I also I did tests, but because I do not know Proview well, and it's hard to figure out what is real situation. http://www.proview.se/components/com_joomlaboard/uploaded/files/pwr-040043e3f2451a3a4d96de4156acf3bf.gz Post edited by: ivo1204, at: 2011/05/18 13:00
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/18 15:18 _____________________________________

Hi Marc, This is the same code as the Arduino sketch version, but it's terrible to read. All in one ... http://www.proview.se/components/com_joomlaboard/uploaded/files/sketch_may18a.gz Shareware on the top maybe need to put #define F_CPU 16000000UL Post edited by: ivo1204, at: 2011/05/18 15:33
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/18 16:14 _____________________________________

Thanks Ivo, New brain food for tonight! My compliments. /Marc


============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/19 13:29 _____________________________________

Hi Marc, New brain food for tonight! I have fresh food now.... This version has two brand new features, it is one of the main causes for this code. The first is that data not be sent to PROVIEW directly, but they are saved in transmitting ring buffer. In this way allows us to continue the cycle without waiting. The second is, plc thread. It is implemented in the main cycle, but each performance evokes only one function. For
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

example, ADC, and other I / O are in plc_adc(). Data transmission to PROVIEW be managed by plc_tx (). Slow tasks and processes are in plc_slow () array. The basic idea is Arduino and Proview to exchange data with other meanings, not only the direct output and inputs.Such as position, velocity and acceleration of the process where direct exchange would otherwise be difficult - for example, step motors. http://www.proview.se/components/com_joomlaboard/uploaded/files/pwr-0caeca85bd3c808aab2f4ff8f4e56e09.gz
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/19 18:43 _____________________________________

Hi Ivo, I can see you builded in a dessert as well. It's "a shame" but the next 3 days I am on a short holiday. When I am back, the first thing I am going to do is to flash the Uno..... Thanks, Marc
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/21 14:05 _____________________________________

Hi Marc, Have a nice vacation! The last thing I put in the code is very lightweight SPI interface with other boards - AVR or Arduino. Of course, it will be necessary modifications and debugging, but now I end. I plan to make cheaper arduino shield, perhaps with ATMega 644p universal motherboard, but so far I have not bought the parts. I think around 10 euros. Good luck, Ivo http://www.proview.se/components/com_joomlaboard/uploaded/files/sketch_may21a.gz
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/23 12:39 _____________________________________

Hi Ivo, Thanks, I had some nice days. This morning I did some tests: In all the tests are: baud rate: 115200 scantime: 5 ms priority: 22

Test 1: arduino.pde from git (feb 2011) 1 analog in (Ai0)


Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

Result: ScanTimeMean: 9 ms Test 2: arduino.pde from git (feb 2011) 1 analog in (Ai0) 1 digital input (Di2) 1 analog out (Ao3) 1 digital input (Di4) Result: ScanTimeMean: 15 ms

Test 3: sketch_may21a.pde 1 analog in (Ai0 pin 0) Result: ScanTimeMean: 9 ms

Test 4: sketch_may21a.pde 1 analog in (Ai0) 1 digital input (Di2) 1 analog out (Ao3) 1 digital input (Di4) Result: ScanTimeMean: 15 ms

Test 5: pde.hex (19-may-2011) 1 analog in (Ai0 pin 0) Result: ScanTimeMean: 9 ms --------------------------------------------------Of course it can be I am completely wrong but I can't see a difference between the standard sketch and the "avr versions". Are you sure, for example the analog read speeds, limits are not limited of the 328p? For example the convertion wait from 1600 clocks sounds a lot but we are running 16Mhz/prescale. If the limitation is in the 328p itself isn't the only way to speed up by choose a lower prescaling factor? But then we can't keep 10 bit resolution..... Sounds very interesting your low budget shield. Thanks for all your input and I wish you good luck whatever you do.... One thing is for sure. You have brains. Take care of them! Greetings, Marc Post edited by: marc, at: 2011/05/23 19:14
============================================================================

Proview-Forum - Proview - Open Source Process Control

Joomlaboard Forum Component version: 1.1.4 Stable

Generated: 2 August, 2011, 16:03

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/24 13:14 _____________________________________

Hi Marc, So nice that you found time for these tests because I really had no idea how to assess the real situation. There are significant changes in the latest version,"sketch_may21a" and they are not to increase the speed, but to make software extensible. So, I tried this version 'sketch_may21b', and gives a very good time.(see picture) With 1 Ao I think you can try to control the stepper motors directly from PROVIEW. Greetings, Ivo http://www.proview.se/components/com_joomlaboard/uploaded/files/sketch_may21b.gz rem: the last two parentheses should be moved here 630 ADCSRA | = _BV (ADSC); / * start conversion, will read value next time * / ==>}} 631 PORTB = Do ; Post edited by: ivo1204, at: 2011/05/24 19:38
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/24 23:31 _____________________________________

Hi Ivo, It seems to be you did it, decreasing the scan time. Tomorrow I will have a better look. And believe me, there have been a couple of forum member lurking and scratching their heads looking at the way you are "playing"..... Thanks, /Marc
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/25 00:59 _____________________________________

Hi Marc, I think that is not connected to my Arduino or other code that is in the work of PROVIEW - when writes only Ao, then the chance is very high speed. And that's fine, because in each Arduino. pde you can write DDRB = value of Ao and it will come out of Port B.. Post edited by: ivo1204, at: 2011/05/25 01:00
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/25 15:48 _____________________________________

Hi Ivo, I have tried to use an Out2P block, Claes suggested a while ago, in combination with a digital output and a 180-degrees servo motor. But our oscilloscope is in use today..... It looks promising.
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

/Marc Post edited by: marc, at: 2011/05/25 16:23


============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/05/25 16:30 _____________________________________

Hi Marc, I tried to take the maximum speed for two Arduino stepper motor. This version is very simple, but you have to have exactly two Ao. they are now and Ao0 Ao1 as voltage pin 6 and 5. Have no problem with speed, so you can try. http://www.proview.se/components/com_joomlaboard/uploaded/files/fast_Ao.gz
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/05/25 22:09 _____________________________________

Man-O-man....., I wish a day had 48 hours and 3 hours was enough to sleep. Right now I am looking at my scope. I see a rock solid pulse, from a standard *.pde sketch from 1.5 ms every 20 ms. My servo is on 90 degrees, quite, not in doubt where to go. Not becoming warm but cool. As it should be. And again, my dog is sitting for the front door, the smile only up side down and I am tired. It's enough. Tomorrow is a new day. With a chef, colleagues and "kids", talking boring nonsense and pulling my ears.... /Marc ps: Ups...., before I forget it. Are you using a h-bridge? Post edited by: marc, at: 2011/05/27 14:31
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/06/02 20:45 _____________________________________

Hi, Small program to test the Arduino - Proview link. http://www.proview.se/components/com_joomlaboard/uploaded/files/Arduno_Proview_Test.gz The file is => Arduno_Proview_Test.tar.bz2 Post edited by: ivo1204, at: 2011/06/02 20:48
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/06/03 02:01 _____________________________________

Hi Ivo,
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

I just looked in aglance at your test app. I have only an old Duemilanove (ATmega168) and a UNO so I changed in Qcreator and rebuilded to /dev/ttyACM0 for the UNO. If I sent 05 02 01 00 20 (Do write 1) which Do-pin should become "HIGH"? Looks very handy your app. Thanks. It's weekend and some time for Proview. After one hour I am sure again, what a beautiful system..... Post edited by: marc, at: 2011/06/04 13:53
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/06/04 18:14 _____________________________________

Hi Marc, First send 'CONFIGURE' message. 10 12 05 90 00 02 00 ff 00 00 10 - message length 12 - ID message 05 - Type CONFIGURE 90 WatchdogTime 00 Di number of bytes 02 D out number of bytes - follow two bytes for the mask Do 00 pins 0 -7 ff -> pins 8-15 are outputs 00 Ai number of bytes - no ...... If you send 05 02 01 00 20, this is the message. 05 message length 12 does not matter 01 Do WRITE message 00 for pins 0-7 20 => 0010 0000 13 pin, Arduno LED ON click on '2 '0 edit to 0, send, LED OFF ==== Give me some time to think of a DC motor, but for now I think that you needed encoder, optical encoder or hall effect, Arduino has a hardware support for them, But the problem is where to find cheap old broken mouse, old printer - optical, a magnetic tape and the hall sensors are even more simple solution Post edited by: ivo1204, at: 2011/06/04 18:15
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/06/04 22:21 _____________________________________

Hi Ivo, Which *.pde or *.hex -version are you using?


============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/06/05 12:50 _____________________________________
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

Hi Marc, I'm sorry , I do not paid attention to pwr_arduino_uno.pde if ( watchdogTime != 0) { // Increment watchdog counter noMessageCnt++; if ( noMessageCnt * delayTime > watchdogTime) resetOutput(); } So, put 0 to watchdogTime parameter 10 12 05 90 00 02 00 ff 00 00 =>10 12 05 '00' ....
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/06/05 17:56 _____________________________________

Hi Ivo, Yep...., it's working. I nice way to check the messages. Thanks again. /Marc
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/07/19 12:20 _____________________________________

Hi Marc, I am working on a very inexpensive solution, everything works, but implementation in PROVIEW I have not yet begun, but at this stage I can not imagine how to tie them.. So check attachment. http://www.proview.se/components/com_joomlaboard/uploaded/files/data.gz
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/07/19 12:56 _____________________________________

Hi Ivo, Great to hear from you. At the moment I am on a "running-between-the-rain-drops-holiday" in Amsterdam. Pretty curious what's in your mind again..... Greetings, Marc
============================================================================

Re:Arduino and Proview


Posted by ivo1204 - 2011/07/30 17:01 _____________________________________

Hi Marc,
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

This is a linux driver for the board, which I wrote before. Further, it might tie with Proview http://www.proview.se/components/com_joomlaboard/uploaded/files/T26.gz Post edited by: ivo1204, at: 2011/07/30 17:02
============================================================================

Re:Arduino and Proview


Posted by marc - 2011/07/30 21:56 _____________________________________

i Ivo, I can see you have been busy again ;-) As far as I understand Proview are there 3 basic possibilities to implement a new I/O. I will try to have a look at your work tomorrow because I appreciate your work and ideas a lot. Next week I have no time at all. My girlfriend has an art expostion next week and I need to help her a lot. Great to hang up a projector, foto collages etc. while drilling is not allowed. If you like art: Her homepage (http://visualartist.dk) is running on a small embedded arm system with the web root on an usb-stick. Pretty slow, please don't remind her, or I must build something new again.... "Talk" to you soon.

/Marc Post edited by: marc, at: 2011/07/30 23:12


============================================================================

Re:Arduino and Proview


Posted by marc - 2011/07/31 22:47 _____________________________________

Hi Ivo,

The 3 basic ways to implement I/O: 1) An application: Create with a main, compile and link to the executable. 2) reading syncronous with a plc thread we have to create IO rack, card classes for the hardware and write IO methods for them. 3) Build in the Proview source

We must start somewhere, lets start with the "easiest" way, an application...... 1) -gdh_Init is for attaching the database -gdh_GetObjectInfo is for getting values -gdh_SetObjectInfo is for setting values but gdh_RefObjectInfo seems to be (Claes) a more efficient way. -Av/Dv object to store the value in database Hopefully Claes is not banging his head on the table but I think the basic structure should be somethin like this:

#include <stdio.h>
Proview-Forum - Proview - Open Source Process Control Joomlaboard Forum Component version: 1.1.4 Stable Generated: 2 August, 2011, 16:03

//basic types Proview #include "pwr.h" //API to database #include "rt_gdh.h" int main() { // Init device .. // Attach the realtime database sts = gdh_Init( "Ivo"); if ( EVEN(sts)) { cout << "gdh_Init failure " << sts << endl; exit(0); }

while (1) { //Write sts = gdh_SetObjectInfo( "project-atiny.ActualValue", &value, sizeof(value)); .. sleep( 1); } }

/M Post edited by: marc, at: 2011/08/01 15:08


============================================================================

Proview-Forum - Proview - Open Source Process Control

Joomlaboard Forum Component version: 1.1.4 Stable

Generated: 2 August, 2011, 16:03

Potrebbero piacerti anche