element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Legacy Personal Blogs TRISE to be an Output.
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: YT2095
  • Date Created: 28 Feb 2012 11:27 AM Date Created
  • Views 547 views
  • Likes 1 like
  • Comments 0 comments
Related
Recommended

TRISE to be an Output.

YT2095
YT2095
28 Feb 2012

Awww c`mon, my spelling`s not That bad! image

I`v been experimenting with the Digilent Uno32 board over the last 2 days, in particular to sse just How arduino compatible it is in the IDE, and what neat things can be done with a board that`s ~5X faster than a 328p chip.

being a simple soul that`s happy with an 8 bit data bus and few control lines to do almost anything I`m likely to want, the First thing I wanted to check was things DDRD and PORTD type commands.

now I know you can use pinmode and digitalwrite and stuff, but I find it more natural to write to ports directly (personal taste), the thing that really surprised me with the MPide, was that PORT`x` commands were actually allowed! image

it totally didn`t like DDR`x` though, so I tried the TRIS command that PICs use and That worked just fine, a Note: on AVR chip all 1`s are Output, on PIC 0`s are output!

ie/

DDRD = B11111111 for outputs on AVR

TRISD = B00000000 for outputs on a PIC

 

anyway, I tried all the Arduino ports like B and D, and they`re not 100% compatible at all, in fact one of them only gives you 7 bits? so Im guessing it`s used internally or on the board for something else.

so naturaly I went through the Alphabet poking around with an LED to see what changed, and port `E` seems to be the droids I was looking for! image

the magic command is TRISE.

so... I wired up my recently built D to A convertor to pins 26 to 33 (LSB to MSB respectively), and wrote probably the smallest program ever;

 

void setup (void) {

TRISE =B00000000;

}

void loop() {

  PORTE = (analogRead(A0)>>1);             

}

 

this little prog simply takes a reading from analog pin 0 and shoves it out as an 8 bit binary number onto pins 26-33, where the D to A board turns it back into Analog again.

you Could use /2 to make it into an 8 bit number instead, but shifting to the right  ">>1" does the same only faster and uses less mem.

also the prog will take a delay of up to 50 micro seconds, so there`s plenty of room to manipulate this data if you plan on using it for Audio without any noticable effects.

 

use this for a simple white noise gen:

void setup()

{ TRISE = B00000000; //sets pins 26 to 33 as outputs

}

 

void loop()                    

{

  int n = random(0,256); //picks a random 8 bit number

  {  

    PORTE = n;  //outputs number `n` to port E                               

    delay(10); // kill this line for a higher frquency

  }

}

 

or for real speed, just have this as your Loop:

PORTE =random(0,256);

 

Hopefully this may save someone a bit of time figuring it out for themselves, and leave them free for doing all sorts of funky Maths stuff with the data!

Now I`m off to listen to Blondie again through my Uno32 board, I have no idea why, but She`s always the "victim" of my A to D to A experiments?

 

C`mon baby, hit those High notes, I need to test my lowpass filter!

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube