pict2c.c

来自「to light a ledfdssssssssffffffffffffffff」· C语言 代码 · 共 37 行

C
37
字号
//<pre>
// pict2c.c
//
// Implementation of the PICT2.ASM program in Easy Pic 'N
//
// Essentially, all you are doing is transferring the value from
// porta to portb. If switches are set on porta, then the program
// will light the appropriate LEDs on portb.
//
// Using '84 on a board (simple solderless breadboard with
// 16F84 on it) and Peter Anderson's include file with 
// port/bit definitions (defs_f84.h available at www.phanderson.com)
// Settings:
// 	4Mhz resonator (not important)
//	All Port A inputs use external pullups (resistor SIP used)
//	Port B outputs tied to a LED array (Radio Shack has 'em)
//	Port A inputs tied to ground through four switches
//	(pullups still are on them - makes it all work!)
//	Flick a switch and the LEDs light up
#case
#include <16f84.h>
#include <defs_f84.h>  // defines registers and bits
#fuses xt,nowdt,put,noprotect


void main(void)
{
   TRISB=0x00;   // make portb all outputs
   TRISA=0x1f;   // make porta all inputs
   while(1)  // always
   {
      PORTB=PORTA;
   }
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?