⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pict5c.c

📁 to light a ledfdssssssssffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
💻 C
字号:
//<pre>
// pict5c.c
//
// Implementation of the PICT5.ASM program in Easy Pic 'N
// demonstrates the state of the status register after a
// math function.
//
// 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!)

#case
#include <16f84.h>
#include <defs_f84.h>  // defines registers and bits
#fuses xt,nowdt,put,noprotect


void main(void)
{
   int N;
   int count=5;

   TRISA=0x1f;   // make porta all inputs
   TRISB=0x00;   // make portb all outputs
   while(1)  // always
   {  N=count-PORTA;
      PORTB=STATUS;
// if N=0 then zero flag will be lit (bit 2 of STATUS)
// if N > or < 0 then zero flag will be off
// if N < 0 then carry will be off (bit 0 of STATUS)
// if N >=0 then carry will be on
   }
}


⌨️ 快捷键说明

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