📦Free shipping over $10 in most countries and regions!



HALJIA Photoelectric Encoder Tacho Generator Speed Sensor Coded Disc Code Wheel for Freescale Smart Car

Regular price $8.99

Shipping calculated at checkout.
Feature:

Number of lines: 100 lines.
Outer diameter: 22mm.
Hole diameter: 3.5mm.
Thickness: 0.3mm.
Material: alloy steel.
Production process: laser cutting.
Supply voltage: 5V (3.3V is also available).
Wiring: Red 5V / Black GND.
Output signal: 5Vp-p two-phase signal output.
Two signal lines, one yellow, one blue.
Yellow and blue are two TTL level signals (can be directly connected microcontroller) 
(Note: Measuring Reversible rely on these two levels to distinguish between forward or reverse).

Packing List:
1*Photoelectric Encoder Tacho Generator Speed Sensor


Test Code:
#include "hidef.h" /* common defines and macros */
#include "MC9S12XS128.h" /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12xs128"

int speed=0;
void init_RTI(void) //1ms
{
RTICTL=0X87;
CRGFLG_RTIF=1
CRGINT_RTIE=1;

PACTL_PAMOD=0;//0 Event counter mode.
PACTL_PEDGE=1;//1 Rising edges on IOC7 pin cause the count to be incremented.
PACTL_PAEN=1;//1 Pulse Accumulator system enabled.
}
#pragma CODE_SEG __NEAR_SEG NON_BANKED
interrupt void RTI(void) 
{
CRGFLG_RTIF=1;

speed=PACNT ;
PACNT=0;
}


void main(void)
{
init_RTI();
/* put your own code here */
EnableInterrupts;

for(;;) {} /* wait forever */
/* please make sure that you never leave this function */