Author Topic: out putting binary from arduino/pic/etc  (Read 3159 times)

0 Members and 1 Guest are viewing this topic.

Offline croylejeTopic starter

  • Regular Contributor
  • *
  • Posts: 83
  • Country: us
    • LazyLinux
out putting binary from arduino/pic/etc
« on: June 02, 2012, 08:19:47 am »
sorry if this is a stupid question but can someone let me know if my thinking is right about this.  basically all micros store there assigned constant or variable values as binary correct? so i can just preform simple math operations within my program then simple shift out or bit bang that value out with out having to convert it into a binary first correct?  iam working with a simple 12 bit DAC and iam getting some output but its not close the what i thought it would be i believe it is spill over from excess bits sent then stored and when i send data again it picks up where it left off adding those excess bits in and just getting worse and worse with each cycle?

really just wondering if my math is right any help would be great thanks ???
 

Offline MikeK

  • Super Contributor
  • ***
  • Posts: 1314
  • Country: us
Re: out putting binary from arduino/pic/etc
« Reply #1 on: June 02, 2012, 10:37:07 am »
It all depends on your compiler and how you're "outputting" it.  Post your code.
 

Offline Jovian

  • Contributor
  • Posts: 11
  • Country: au
Re: out putting binary from arduino/pic/etc
« Reply #2 on: June 02, 2012, 10:44:50 am »
Hello croyleje,

From the sounds of it you already have some code written and a circuit set up. Could you post that to help us help you?
Yes, all microcontrollers use binary to represent the data they store/operate on.
To your second question about how to push out this data to a pin on the device; it is dependant on what programming language you are using. If you are using Assembly then this is very simple; however, if it is BASIC or C then you must take care to prevent the programming language doing anything "funny" to the data you wish to output.

Regards,
Jovian.
"Then we start getting into some of what I can only describe as weird messed-up alien voodoo black magic stuff that I wouldn't claim to understand."
---Mike Harrison, 2012.
 

Offline Ed.Kloonk

  • Super Contributor
  • ***
  • Posts: 4000
  • Country: au
  • Cat video aficionado
Re: out putting binary from arduino/pic/etc
« Reply #3 on: June 02, 2012, 11:14:37 am »
sorry if this is a stupid question but can someone let me know if my thinking is right about this.  basically all micros store there assigned constant or variable values as binary correct? so i can just preform simple math operations within my program then simple shift out or bit bang that value out with out having to convert it into a binary first correct?  iam working with a simple 12 bit DAC and iam getting some output but its not close the what i thought it would be i believe it is spill over from excess bits sent then stored and when i send data again it picks up where it left off adding those excess bits in and just getting worse and worse with each cycle?

really just wondering if my math is right any help would be great thanks ???

In the long ago, I had a 'high end' computer sound card that was abandoned by it's makers and I needed to get it working on a system that did not exist when the card was manufactured. The problem was that the card would transfer samples to/from a 20 bit ADC/DAC but would report in it's registers a 24 bit word or three bytes. And more annoyingly the nibbles (four bits) were scattered all over the place in those three bytes or six if it was stereo.

The solution was to feed good, clean sine waves, square waves and triangular waves into the ADC and try and generate the same on the output connected to a scope. For an arduino, I'd suggest you hard code a nice waveform and get the device to repeat it over and over while looking at the scope to see what is wrong.

-facepalm-

Sorry. Wow. Why did I just make that so complicated?

Just hard-code all of the 12 bit 'ones' and configure a button press on the arduino to cycle through all twelve of them. And make note of each result. Eventually something in the code should jump out at you.

And yes, please post us some code. Inquiring minds want to know.  ;)
iratus parum formica
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11702
  • Country: my
  • reassessing directives...
Re: out putting binary from arduino/pic/etc
« Reply #4 on: June 02, 2012, 11:46:44 am »
sounds like a bits alignment problem or clock desynchronization (serial comm?). are you aware there's 2 bytes to store 12bit adc?
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline croylejeTopic starter

  • Regular Contributor
  • *
  • Posts: 83
  • Country: us
    • LazyLinux
Re: out putting binary from arduino/pic/etc
« Reply #5 on: June 02, 2012, 03:55:25 pm »
thanks everyone ill post code and and circuit when i get home appreciate it
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf