caramoan tour package

caramoan tour package

Author Topic: R-2R DAC.. wala lang..baka makatulong  (Read 201 times)

Offline RaffT

  • Technical People
  • Hydroelectric
  • *****
  • Posts: 3440
  • Pogi/Ganda Points: 103
  • Gender: Male
  • more on R-n-D
    • MY Bots
R-2R DAC.. wala lang..baka makatulong
« on: March 16, 2011, 10:25:39 AM »
after a few months na walang coding with PIC, nagbalik ulit ako dahil kailangan.. hehehe  ;D

still in its infancy... trip lang..



Code: [Select]
/*
====================
Rafft@Elab.Ph
R-2R DAC 8 bit

note: a test run only
====================
*/
#include <16f84a.h>
#fuses XT,NOWDT,NOPROTECT
#use delay(clock=4000000)

void main()
{
 unsigned int d = 10;
 //initialization
 //set_tris_a(0b00011110);   //RA0=output;RA1-4=input
                           //5 I/O pins only on RA
 set_tris_a(0b00000000); // all RA ports are set to output
 set_tris_b(0b00000000); //ALL RB0-7 set as OUTPUT
 
 output_a(0b00000000); //output init
 output_b(0b00000000); //output init
 
 for(;;)
   {
   output_b(152);
   delay_ms(d);
   output_b(176);
   delay_ms(d);
   output_b(198);
   delay_ms(d);
   output_b(217);
   delay_ms(d);
   output_b(233);
   delay_ms(d);
   output_b(245);
   delay_ms(d);
   output_b(252);
   delay_ms(d);
   output_b(254);
   delay_ms(d);
   //-------------------
   output_b(252);
   delay_ms(d);
   output_b(245);
   delay_ms(d);
   output_b(233);
   delay_ms(d);
   output_b(217);
   delay_ms(d);
   output_b(198);
   delay_ms(d);
   output_b(176);
   delay_ms(d);
   output_b(152);
   delay_ms(d);
   //--------------------
   output_b(128);
   delay_ms(d);
   output_b(103);
   delay_ms(d);
   output_b(79);
   delay_ms(d);
   output_b(57);
   delay_ms(d);
   output_b(38);
   delay_ms(d);
   output_b(22);
   delay_ms(d);
   output_b(10);
   delay_ms(d);
   output_b(3);
   delay_ms(d);
   output_b(0);
   delay_ms(d);
   //-------------------
   output_b(3);
   delay_ms(d);
   output_b(10);
   delay_ms(d);
   output_b(22);
   delay_ms(d);
   output_b(38);
   delay_ms(d);
   output_b(57);
   delay_ms(d);
   output_b(79);
   delay_ms(d);
   output_b(103);
   delay_ms(d);
   output_b(127);
   delay_ms(d);
   
   
   }
 
 
}


;D



Learning is CooL! BEAM robotics/DIY UCD180/PSP/AC wtmtr/digiESRmtr/PICkit™2 clone/SGTC/SSTC/DR-SSTC

Never argue with an idiot... They'll take you down to their level and beat you with experience

Philippine Electronics Forum

R-2R DAC.. wala lang..baka makatulong
« on: March 16, 2011, 10:25:39 AM »

 

Privacy Policy

Contact Us: elabph@yahoo.com