Show Posts
Pages: 1 2 [3] 4 5 ... 2312
31  Using Arduino / Project Guidance / Re: Analogue read 4Mhz, and Write Out on: September 15, 2014, 07:59:25 am
Yes
Code:
inline void digitalWriteDirect(int pin, boolean val){
  if(val) g_APinDescription[pin].pPort -> PIO_SODR = g_APinDescription[pin].ulPin;
  else    g_APinDescription[pin].pPort -> PIO_CODR = g_APinDescription[pin].ulPin;
}
inline int digitalReadDirect(int pin){
  return !!(g_APinDescription[pin].pPort -> PIO_PDSR & g_APinDescription[pin].ulPin);
}

void setup() {
pinMode(21,OUTPUT);
}
int a;
void loop() {
a = digitalReadDirect(22);  
digitalWriteDirect(21,HIGH);
a = digitalReadDirect(22);
digitalWriteDirect(21,LOW);
}

there is a long overhead on the loop function giving a 420KHz cycle time.
Also what you can not see with that scope trace is the very large amount of jitter on the signal.

32  Using Arduino / Networking, Protocols, and Devices / Re: Connecting Arduino Uno and Due with UART on: September 15, 2014, 06:24:30 am
You need a simple resistive divider from the arduino's TX to the Due's RX.
Then from the Due to the arduino you need a single transistor inthe common base mode.
33  Using Arduino / Project Guidance / Re: Analogue read 4Mhz, and Write Out on: September 15, 2014, 02:48:43 am
Quote
what about other arduino boards which are a little more faster than Uno
The Due runs at 84MHz and so is a lot faster than the 16MHz Uno.

Running this code on a Due:-
This simulates what you want to do, read then output, although I haven't got an input signal this shows how long it would take if the input signal were to change after every read.

Code:
void loop() {
a = digitalRead(22); 
digitalWrite(21,HIGH);
a = digitalRead(22);
digitalWrite(21,LOW);
}

I get a loop time of 9.2uS. Which translates to a top speed of 108KHz.
See the attached scope trace.
So there is no way you can read in a 4MHz signal and output it.

I know there are other ways to get at the I/O signals using port manipulation but these results show the OP's requirements are not easy.

The best way to do this ( what ever "this" is ) is to use some hardware.

34  Using Arduino / Networking, Protocols, and Devices / Re: UART/USART serial communication over a few meters cable on: September 15, 2014, 02:11:07 am
The MAX232 is not a 3v3 device it is a 5V device.
For a 3v3 system, use a MAX3232
35  Using Arduino / General Electronics / Re: H-bridge driver with discrete mosfets on: September 15, 2014, 02:02:13 am
http://uk.farnell.com/nxp/uba2037t-n1/hid-cntrl-full-bridge-so24/dp/2066162?Ntt=UBA2037tI know it says out of stock but it also says short lead time.
This means that they can get it quickly but you can't have it tomorrow.
36  Using Arduino / Sensors / Re: Unable to compile sketch for multiple sensors on: September 15, 2014, 01:32:55 am
You would have better spent part of that day reading the how to use the forum sticky post. The bit about how to post your code.
See the bit in the middle where the text changes to italics?
That is the forum mangling a bit of your code so no one else can reproduce what you did.
Modify that post to use code tags and we can help you find where you have made your error.
37  Using Arduino / General Electronics / Re: simple simulation of pins on arduino? on: September 15, 2014, 01:24:10 am
Quote
So, essentially no current will flow into an output pin when it is turned off (low)
No when an output pin is low there is the same impedance to ground as there was to 5V when it was high.
38  Using Arduino / Project Guidance / Re: digitalWrite Code explanation on: September 14, 2014, 02:24:54 pm
That code is total tosh.
It will not compile and has no terminating ;
With digital write you can only write high or low to a pin.
the code should / could be:-
Code:
if (distance < 20)  // if the distance is less than 20
digitalWrite(buzzer, HIGH); // then turn on the buzzer
39  Using Arduino / Microcontrollers / Re: How many bytes can Arduino UNO handle on: September 14, 2014, 02:20:04 pm
It is hard to tell without seeing all your code.

Quote
do you mean I should encrypt 128 byte of data 2 times and send?
No.
Send the 256 bytes but on the receive side you have to wait until a byte is in before you read it. It is hard to see with what you have posted it looks like the delay 2mS is not long enough for the second buffer. Remove the delay altogether and only read a byte when serial available tells you there is data to read.
40  Using Arduino / Programming Questions / Re: Can someone pleeeease help. on: September 14, 2014, 01:34:01 pm
Read how to use this forum, then go back and put code tags round that code.
41  Using Arduino / Programming Questions / Re: Serial.read() multiple bytes on: September 14, 2014, 01:32:59 pm
Quote
when i try to read a byte B with Serial.read() immediately after i have read a byte A with Serial.read(), byte B always ends up being 255.
Yes it will.

Code:
if (Serial.available() > 0){
Says if one byte is in the buffer read two, now isn't that silly. Still it is a common mistake.

So wait until all the expected bytes are in or do a
Code:
while( Serial.available() == 0){ } // hold until serial byte is available
In front of each read.

42  Using Arduino / LEDs and Multiplexing / Re: 4" common anode 7-segments: driver reference to buy in 2014 on: September 14, 2014, 11:54:41 am
Looks good to me.

Quote
I haven't found the Output Enable (OE) for PWM.
Pin 9
43  Using Arduino / Audio / Re: Change wav file playback speed. on: September 14, 2014, 11:40:27 am
Quote
If you change the sampling frequency it has no influence on audiable playback speed.
Sorry but you are wrong.

Quote
There is pySonic library for python look at UserSpeed method of the Song object.
Remember this is not a Linux machine this is an embedded processor.
44  Using Arduino / General Electronics / Re: Problem with uploading the sketch for my DIY Arduino uno on: September 14, 2014, 03:11:09 am
Quote
connected all 4 required pin
The main snag is that you require 5  pins not 4.
The extra one is the DTR pin through a 0.1uF capacitor to the reset pin.

Have you got the drivers for that chip installed? Are you seeing it in the tools menu?
Are you on a Mac? The DTR does not work correctly on that system.
45  Using Arduino / Project Guidance / Re: connecting two arduino boards on: September 14, 2014, 03:05:03 am
Can I connect this large number of this IC (70 IC) together
It could be done but I think it is outside your skill set at the moment to do it. It is simply too big of a project for you to tackle. Even if you have the right schematic the construction requires special techniques depending on the physical layout of everything. You will end up making everything and it will not work even though the schematic would be correct.
Pages: 1 2 [3] 4 5 ... 2312