10 Ağustos 2007 Cuma

PIC16F628A









On these pages, I will explain the hardware specification of PICF628. The contents of the explanation is the part which is different from PIC16F873. So, as for the basic specification, refer to PIC16F84A and PIC16F873. As for the detail specification, refer to PIC16F628.
PIC16F628 is PIC which has a lot of features than PIC16F84A. Those functions are the function which is adopted in PIC16F873. The program memory is 2K Words, the RAM memory is 224 bytes and the EEPROM is 128 bytes. It has three kinds of timers, Analog Digital converter, Universal communication port and so on. Also, it has one set of CCP.
Flash memory is used for PIC16F628 like PIC16F84A and PIC16F873. So, the program can be easily rewritten by the PIC programmer. This is very convenient. The instructions of the software are same as PIC16F84A and PIC16F873. The number of the pins is 18 pins like 84A.
RA0-7 : Input/Output port A
RB0-7 : Input/Output port B
AN0-3 : Analog input port
RX : USART Asynchronous Receive
TX : USART Asynchronous Transmit
DT : Synchronous Data
CK : Synchronous Clock
CCP1 : Capture In/Compare Out/PWM Out
OSC1/CLKIN : Oscillator In/Ecternal Clock In
OSC2/CLKOUT : Oscillator Out/Clock Out
MCLR : Master Clear ( Active low Reset ) Vpp : Programming voltage input
T0CKI : Clock input to Timer0
T1OSO : Timer1 oscillator output
T1OSI :Timer1 oscillator input
PGD : Serial programming data
PGC : Serial programming clock
PGM : Low voltage programinng input
INT : External interrupt
VDD : Positive supply for logic and I/O pins
Vss : Ground reference for logic and I/O pins

SFR of PIC16F628
The RAM register file of PIC16F628 is divided into four like PIC16F873. Each size is 128 bytes. SFR(Special Function Registers) are allocated at 32 bytes from the head of each bank. After the 33rd byte is the register area which is possible to use freely. However the area which can be used is different from 873.

CONFİGURATİON WORD
PIC16F628 has the special area to say Configuration Word in the program memory.
This word is mapped in program memory location 2007h. This address is beyond the user program memory space. This word can be accessed only during programming.
The following system requirements of PIC can be designated by the configuration word.




CP1,CP0 : Code Protection bits ( These differ from PIC16F84A or PIC16F873 )
All of the CP1:CP0 pairs have to be given the same value to enable the code protection scheme listed.
11 : Program memory code protection off
10 : 0400h-07FFh code protected
01 : 0200h-07FFh code protected
00 : 0000h-07FFhcode protected


--------------------------------------------------------------------------------

CPD : Data Code Protection bit
1 : Data memory code protection off
0 : Data memory code protected


--------------------------------------------------------------------------------

LVP : Low Voltage Programming Enable
1 : RB4/PGM pin has PGM function, low voltage programming enabled
0 : RB4/PGM is digital I/O, HV on MCLR must be used for programming


--------------------------------------------------------------------------------

BODEN : Brown-out Detect Reset Enable bit
1 : BOD Reset enabled
0 : BOD Reset disabled


--------------------------------------------------------------------------------

MCLRE : RA5/MCLR pin function select ( This bit is newly provided for PIC16F628 )
1 : RA5/MCLR pin function is MCLR
0 : RA5/MCLR pin function is digital Input, MCLR internally tied to VDD


--------------------------------------------------------------------------------

PWRTE : Power-up Timer Enable bit
1 : PWRT disabled
0 : PWRT enabled


--------------------------------------------------------------------------------

WDTE : Watchdog Timer Enable bit
1 : WDT enabled
0 : WDT disabled


--------------------------------------------------------------------------------

FOSC2,FOSC1,FOSC0 : Oscillator Selection bits ( Functions are added )
111 : ER(External Resistor) oscillator:
CLKOUT function on RA6/OSC2/CLKOUT pin, Resistor on RA7/OSC1/CLKIN

110 : ER(External Resistor) oscillator:
I/O function on RA6/OSC2/CLKOUT pin, Resistor on RA7/OSC1/CLKIN

101 : INTRC(Internal 4MHz OSC) oscillator:
CLKOUT function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN

100 : INTRC(Internal 4MHz OSC) oscillator:
I/O function on RA6/OSC2/CLKOUT pin, I/O function on RA7/OSC1/CLKIN

011 : EC(External Clock In):
I/O function on RA6/OSC2/CLKOUT pin, CLKIN on RA7/OSC1/CLKIN

010 : HS oscillator: High speed crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN

001 : XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN

000 : LP oscillator: Low power crystal on RA6/OSC2/CLKOUT and RA7/OSC1/CLKI

Timer of PIC16F628
PIC16F628 has three kinds of timer. The specification of each timer is same as PIC16F873.


Timer 0

The specification of timer0 is same as PIC16F84A. It has following features.

8 bits timer/counter TMR0 ( It can count up to 255 )
Readable and Writable counter
8 bits software programmable prescaler
( Shared with watchdog timer. It can be used in either)
Selectable internal clock or external clock
Interrupt on overflow from FFh to 00h
Edge select for external clock ( Rising edge or falling edge )


As for the specification, refer to the specification of the timer (TMR0).


--------------------------------------------------------------------------------


Timer 1

The timer1 module is a 16 bits timer/counter consisting of two 8 bits registers( TMR1H and TMR1L ). Also it has prescaler. It can be selected four values.
The overflow interruption can be enabled/disabled by setting/clearing TMR1 interrupt enable bit TMR1IE of PIE register. The interruption occurs when the counter rolls over to 0000h from FFFFh.

There are a timer mode and a counter mode in timer1. The operating mode is determined by the clock select bit ( TMR1CS bit of T1CON register ). In case of TMR1CS is cleared, it works as Timer, and in case of TMR1CS is set, it works as Counter.



Timer mode
In timer mode, Timer1 increments every instruction cycle (FOSC/4). Timer1 can be enable/disable by setting/clearing control bit ( TMR1ON bit of T1CON register ). Also, timer1 has an internal reset input. This reset can be generated by either of two CCP modules.

When the timer1 oscillator is enabled by setting T1OSCEN bit of T1CON register. In the case, it connects a crystal oscillator with Pin 12 and pin 13. The oscillation frequency is possible to 200KHz. These pins combine the input/output pin of RB6 and RB7. However, the feature as the input/output pin is ignored. The setting of TRISC register is ignored too.

Counter mode
In counter mode, Timer1 increments on every rising edge of clock input.
When T1OSCEN bit of T1CON register is cleared, Timer1 increments on every rising edge of clock input on pin RB6/T1OSO/T1CKI( pin 12 ).
When T1OSCEN bit of T1CON register is set, Timer1 increments on every rising edge of clock input on pin RB7/T1OSI( pin 13 ).
After Timer1 is enabled in counter mode, the module must first have a falling edge before the counter begins to increment. When started from the L level, the first rising edge isn't counted.
If T1SYNC bit of T1CON register is cleared, the external clock input is synchronized with internal phase clocks. The synchronization is done after the prescaler stage.

In Capture and Compare mode of CCP, timer1 is used.
In case of the asynchronous counter mode, the counter can not be used for the capture or compare feature.
As for the operation of the CCP, refer to CCP feature of PIC16F873.



--------------------------------------------------------------------------------


Timer 2

Timer2 is an 8 bits timer with a prescaler and a postscaler and it has an 8 bits period register PR2 The input clock (Fosc/4) has a prescale option of 1:1, 1:4 or 1:16 selected by T2CKPS1 and T2CKPS0 bits of T2CON register. The match output of TMR2 goes through a 4 bits postscaler which gives a 1:1 to 1:16 scaling inclusive
Timer2 increments from 00h until it matches PR2 and then reset to 00h on the next increment cycle. Then timer2 repeats incrementation from 00h to the value of PR2. The PR2 register is initialized to FFh upon reset. The match output of TMR2 goes through a postscaler to generate a TMR2 interruption ( latched in flag bit TMR2IF of PIR register ). Timer2 can be shut off by clearing TMR2ON bit of T2CON register to minimize power consumption.

Timer 2 is used for the PWM feature of CCP mainly. It is used to control the period of the continuation pulse.
As for the operation of the CCP, refer to CCP feature of PIC16F873.
CCP feature of PIC16F628


The PIC16F873 has a special feature as CCP.
CCP is the initial of Capture/Compare/PWM(Pulse Width Modulation).
PIC16F873 has one CCP module.

Because a CCP function is the same as that of PIC16F873, so some part of pages for PIC16F873 are used in the following explanation.

Capture This is the function to capture the 16 bits value of timer1 register when an event occurs on pin RB3/CCP1.
This can be used for the measurement of the period time of the signal like the frequency counter and so on.
Compare This is the function to compare constantly the 16 bits value of timer1 register against the CCPR1 register value.
This is convenient when it makes interruption occur periodically.
PWM This is the function to make a periodic pulse generate.
This function is used to control an external circuit with changing a pulse duration (Duty).


The timer resource of the capture and compare is timer1 and the timer resource of PWM is timer2.

CCP1 register is comprised of two 8 bits registers : CCPR1L for low byte and CCPR1H for high byte. The CCP1CON register controls the operation of CCP1. The special event trigger is generated by compare match and will reset Timer1.


--------------------------------------------------------------------------------


Capture mode

In Capture mode, CCPR1H : CCPR1L captures the 16 bits value of the TMR1 register when an event occurs on pin RB3/CCP1. In Capture mode, the RB3/CCP1 pin should be configured as an input by setting the TRISC register. If the RB3/CCP1 pin is configured as an output, a write to the port can cause a capture condition.

An event is defined as follows. An event is selected by control bits CCP1M3:CCP1M0 of CCP1CON register.


CCP1M3-0 Event
0000 CCP off ( resets CCP1 module )
0100 Every falling edge
0101 Every rising edge
0110 Every 4th rising edge
0111 Every 16th rising edge


When a capture is made, the interrupt request flag bit CCP1IF of PIR1 register is set. The interrupt flag must be cleared in software. If another capture occurs before the value in register CCPR1 is read, the old captured value will be lost.

Timer1 must be running in timer mode or synchronized counter mode for the CCP module to use capture feature. In asynchronous counter mode, the capture operation may not work. When the capture mode is changed, a false capture interrupt may be generated, You should keep bit CCP1IE of PIE register clear to avoid false interrupts and should clear the flag bit CCP1IF of PIR1 register following any such change in operating mode.

--------------------------------------------------------------------------------


Compare mode

In Compare mode, the 16 bits CCPR1 register value is constantly compared against the TMR1 register pair valueWhen a match occurs, the following actions will be done by the definition of CCP1M3:CCP1M0 of CCP1CON register.


CCP1M3-0 Action
1000 Set output on match ( CCP1IF bit is set )
1001 Clear output on match ( CCP1IF bit is set )
1010 Remains unchanged on match ( CCP1IF bit is set )
1011 Trigger special event ( CCP1IF bit is set )
Remains unchanged on match
In case of CCP1, resets TMR1


In Compare mode, the RB3/CCP1 pin should be configured as an output by setting the TRISC register.
Timer1 must be running in timer mode or synchronized counter mode for the CCP module to use compare feature. In asynchronous counter mode, the compare operation may not work.

For PWM operation, CCP1M3 and CCP1M2 bits of CCP1CON register should be set.


CCP1M3-0 Operation
11xx PWM mode


In PWM mode, the RB3/CCP1 pin should be configured as an output by setting the TRISC register.
The PWM period is specified by the value of the PR2 register, the clock oscillation period and the prescaler value of Timer2.
The PWM duty cycle( the output stays high ) is specified by the value of CCPR1L register, the clock oscillation period and the prescaler value of Timer2. The CCPR1L contains the eight MSbs and CCP1X:CCP1Y contains the two LSbs.
The shortest duty cycle is the period time of the oscillator. In case of 10MHz oscillator, it is 0.1 microseconds. The maximum PWM resolution of the duty cycle is 1024.
If the PWM duty cycle value is longer than the PWM period, the CCP1 pin will not be cleared. Also, if the value of PWM duty cycle register( CCPR1L+CCP1X+CCP1Y ) is set to zero, the CCP1 pin will not be set.

For the details about PWM period and PWM duty cycle, refer to the page of PIC16F873.


--------------------------------------------------------------------------------


PWM mode
In PWM(Pulse Width Modulation) mode, the CCP1 pin produces up to a 10 bits resolution PWM output
Asynchronous communication of PIC16F628 (USART)
On this page, I will explain about USART which is the communication port equipped with PIC16F628.
USART is the initial of Universal Synchronous Asynchronous Receiver Transmitter.
Because this function is equipped with PIC16F873, so some part of pages for PIC16F873 are used in the following explanation.

The USART can be used following communicate mode.
Asynchronous
Synchronous - Master
Synchronous - Slave ( full duplex )
( half duplex )
( half duplex )

Generally, in the communication of the USART, one data block is composed of 8 bits.
The USART module also has a multi-processor communication capability using 9-bit address detection.

On this page, I will explain about Asynchronous mode communication.


--------------------------------------------------------------------------------


About asynchronous communication

When doing a data communications, the condition of "0" and "1" to have let out from the side of the sending it must be able to be recognized in the receiving side. In the asynchronous communication, it puts a start bit to the head of the transferred data(8 bits or 9 bits) and it puts a stop bit at the end of the data. Recognition in the data block is done by it. The start bit is an L level and the stop bit is the signal of the H level.
The circuit of the condition not to transfer data is H level. When becoming an L level(Start bit) from this condition, the receiving side recognizes that the data transfer begins. After that, according to the signaling speed, the transfer of the data is done. The transfer of the block ends when a stop bit (H level) is detected last. A signaling speed is controlled by the timer which is independent in the sender and the receiving side. So, it isn't possible to do correct communication when there is an error in this timer.
In the asynchronous mode communication of USART, the RX port is used for receiving and the TX port is used for the transmission, so, it is possible to send and receive at the same time. (Full duplex)


--------------------------------------------------------------------------------



Designation of port
In the asynchronous mode, it uses RB2/TX/CK (pin 8) for the data transmission and RB1/RX/DT (pin 7) is used for the data receiving. The mode of the input/output of the TX port, the RX port must be set to the TRISC register to use a USART. Bit 2 of B port is set to output mode (0) and bit 1 is set to input mode (1).

To use RB1 and RB2 as the USART port, the SPEN bit of the RCSTA register must be made "1".

--------------------------------------------------------------------------------



Designation of Asynchronous mode

Asynchronous mode is designated by clearing bit SYNC of the TXSTA register.


--------------------------------------------------------------------------------



Designation of signaling speed

The signaling speed of the USART is controlled by BRG(Baud Rate Generator). BRG is used both the asynchronous and synchronous modes of the USART.
BRG is controlled by the SPBRG register. It is the register to control a free run timer with byte. In case of asynchronous mode, BRGH bit of the TXSTA register is used for the control of the signaling speed too.
When writing a value in the SPBRG register, BRG timer is reset.

The clock frequency of the PIC and signaling speed can be calculated by the following formula.
Mode Low-speed (BRGH=0) High-speed (BRGH=1)
Asynchronous
(SYNC=0) Fosc/( 64( X + 1 )) Fosc/( 16( X + 1 ))
Synchronous
(SYNC=1) Fosc/( 4( X + 1 ))

Fosc is the clock frequency of the PIC.
X is the value of SPBRG register. It is 0 to 255

For the details of the value of the SPBRG register, refer to "SFR explanation for PIC16F873(17)".

--------------------------------------------------------------------------------

Transmitter operation
When doing an asynchronous transmission with the USART, it makes the SPEN bit of the RCSTA register "1" and it makes RB2 port as TX port.
When loading a transmit data to the TXREG register, it is transferred to the TSR(Transmit Shift Register) by the hardware and it is transmitted from the TX port. The transmission of the data is done by setting the TXEN bit of the TXSTA register.
LSb(Least Significant bit) is transmitted first.
When the contents of the TXREG are sent to the TRS, the TXIF bit of the PIR1 register becomes "1" and the interruption occurs. But, the TX1E bit of the PIE1 register must become "1". This interruption means that the contents of the TXREG has been sent to the TSR and it becomes the condition that it is possible to load data in the TXREG. The data can be continuously transmitted if detecting this interruption and setting the following data to the TXREG.(Back to Back) The TXIF bit can not be cleared in software. The TXIF bit is cleared when data is loaded in the TXREG.
The TRMT bit of the TXSRA register is set to "1" when the data of the TSR register is transmitted. This bit doesn't have an interruption logic. So, to confirm the empty of the TSR register, you should poll TRMT bit periodically.
Because the TSR register is not mapped in data memory, you can not read/write the contents of this register directly. A signaling speed is controlled by BRG(Baud Rate Generator).
Parity is not supported by the hardware, but can be implemented in software ( and stored as the ninth data bit ). In the case, ninth bit as parity is transmitted by setting parity bit contents to the TX9D bit of the TXSTA register and setting the TX9 bit. The TX9D bit must be set before setting the data to TXREG. A transmission is started as soon as loading data in the TXREG. It isn't normally transmitted when the ninth bit isn't set to TX9D before it.
When clearing TXEN bit while transmitting data, a transmitter is reset and the RB2/TX/CK pin becomes a high impedance condition.


Steps to follow when setting up an Asynchronous Transmission
1. Initialize the SPBRG register for the appropriate baud rate.
If a high speed baud rate is desired, set bit BRGH.
2. Enable the asynchronous serial port by clearing SYNC bit of the TXSTA register and setting SPEN bit of the RCSTA register.
3. If interrupts are desired, then set enable bit TXIE of the PIE1 register.
4. If 9-bit transmission is desired, then set transmit bit TX9 of the TXSTA register.
5. Enable the transmission by setting bit TXEN of the TXSTA register.
In this point, the TXREG register is in the condition to write that is possible and TXIF bit of the PIR1 register becomes "1".
6. If 9-bit transmission is selected, the ninth bit should be loaded in bit TX9D.
7. Load data to the TXREG register.
( Start transmission )

------------------------------------------------------------------------------

Transmission time chart of 1 Word

Transmission time chart of the continuation transmission (Back to Back)

--------------------------------------------------------------------------------
Receiver operation
When doing an asynchronous transmission with the USART, it makes the SPEN bit of the RCSTA register "1" and it makes RB1 port as RX port.
The data which was received at the RX port is received with the RSR register through the Data recovery circuit. Data at the RX port is sampled three times to do the judgment of the H level or the L level. A received data is stored in the RSR register according to the signaling speed which is specified by the SPBRG register and the BRGH bit of the TXSTA register.
When detecting a stop bit, the contents of the RSR register are transferred to the RCREG register. The RCIF bit of the PIR1 register is set when data is stored in the RCREG register and the interruption occurs. To make interruption occur, the RCIE bit of the PIE1 register must be set beforehand.
The RCREG register is composed in two FIFO(First In First Out) buffers and can store data for 2 block. This is the protection when delay in the reading processing by the software. RCIF bit is read only bit and is cleared with the hardware when all RCREG registers are read.
If both RCREG registers are full(It isn't read) when the receiving completes with the RSR register, the OERR bit of the RCSTA register is set and the occurring of the overrun error is expressed. The data which was stored in the RSR register at this time is lost. Also, receiving operation isn't done. It clears the CREN bit of the RCSTA register once and it sets to return this condition normally again. By this operation, OERR bit is cleared.
The FERR bit of the RCSTA register is set when the frame error detects with the RSR register. The RX9D bit and the FERR bit which is stored in the RCSTA register are rewritten every time it receives data in 1 block. So, the FERR bit of the RCSTA register must be checked before reading the contents of the RCREG register. When receiving a normal frame behind the error frame, the information of FERR disappears. So, the normality of the received data can not be judged.

Steps to follow when setting up an Asynchronous Reception
1. Initialize the SPBRG register for the appropriate baud rate. If a high speed baud rate is desired, set bit BRGH of the TXSTA register.
2. Enable the asynchronous serial port by clearing bit SYNC of the TXSTA register and setting bit SPEN of the RCSTA register.
3. If interrupts are desired, then set enable bit RCIE of the PIE1 register.
4. If 9-bit reception is desired, then set bit RX9 of the RCSTA register.
5. Enable the reception by setting bit CREN of the RCSTA register.
6. Flag bit RCIF of the PIR1 register will be set when reception is complete and an interrupt will be generated if enable bit RCIE of the PIE1 register is set.
7. Read the RCSTA register to get the ninth bit (if enabled) and determine if any error occurred during reception.
8. Read the 8-bit received data by reading the RCREG register.
9. If any error occurred, clear the error by clearing enable bit CREN of the RCSTA register.

Receiving time chart

This time chart shows the situation which the over-run occurs.
In usual operation, because the contents of RCREG are read by the interruption of RCIF, the over-run doesn't occur.

--------------------------------------------------------------------------------
Address detection

The 9th bit can be used for the address data detection. I don't understand a way of using address data.
The operation is as follows. This operation is effective in case of 9-bit transfer.
Set RX9 bit and ADDEN bit of the RCSTA register. In this way, only when the data of the 9th bit is "1", received data is stored in the RCREG register. The data that the 9th bit is "0" isn't stored.

Hiç yorum yok:

Cascode stage
or “collector follower”
Jean-Paul Brodier
All microprocessors from the 8051 family have inputs and outputs that are ‘quasi-bidirectional’. This means that when power is first applied, the ports behave as inputs with a logic high level and a weak pull-up.,

Glitch
a relay or some other load such as When driving an optocou-pler or LED, there is a problem
at power on: the NPN transistor in the common emitter connec­tion (Figure 1) causes an unde­sirable excitation of the load from the moment power is applied until the microprocessor has had the chance to turn the output low. In addition, logic high outputs are seldom able to deliver enough current to drive the transistor into saturation because they have been designed to be active low.
Figure 1. An NPN transistor drives a load.
To solve both of these problems in one hit, we have to make the active level logic low. This can be done in three different ways: use an emitter follower as a buffer stage (Figure 2a), an inverter in a common emit­ter circuit (Figure 2b) or an inverter/open collector circuit (Figure 2c). The disadvantage of solution 2a is the fact that the voltage to the load is reduced. In the case of a relay with a 5-V coil there is the risk that the resulting voltage is too low. The disadvantage of examples 2b and 2c is that they require more parts.
Collector follower
That leaves the open collector buffer in the form of an IC type 7404. This solution, however, also has a few disadvantages. You do not always need all of the 6 buffers in one IC. Also, the SMD version can only handle 12 V. This is too low and dan­gerous if we happen to supply the load from an unregulated voltage.
The solution presented here com­bines in one transistor the advan­tages of the emitter follower (inactive when power is first applied) and open collector (higher power supply voltage, lower current). This circuit has been known since the valve era by the name cascode (drive via the cathode). The goal was to reduce the Miller-effect of the internal (parasitic) capacitances. Not having the option of reduc­ing the capacitance between the internal electrodes, a lower volt­age was used instead. The cas-code circuit is often used in pow­erful transmitters (tens of kW) to minimise the Miller-effect. This circuit was also used to limit tran­sistor conduction and to keep the dissipation within bounds, which increased the life of bipolar tran­sistors. This was in the IGBT and VMOS era.
The transistor conducts only when the output from the micro­processor is low (refer Fig­ure 3). The base current is lim­ited by resistor R. This current is determined by the current flow­ing through the load. When the power is switched on, both the base and emitter see the same potential, VCC, so the transistor remains blocked. One thing we have to keep in mind: we may not exceed the current rating of the microprocessor output because it has to cope with all the current flowing in the emitter of the transistor.
In the case of the quite common 80C51, this maximum current is typically 3.2 mA (two LS TTL loads). This is sufficient to drive an LED without overloading the 5-V regulator, or for driving a PNP power stage at the high side (Figure 3b). The parallel Philips PCF88574 I2C interfaces can handle 25 mA. For the Atmel AT89Cx051 as well as for the Philips P89LPC9xx the limit is 20 mA. For the latter type the cascode circuit or ‘collector fol­lower’ is even more interesting when the outputs are configured as open-drain because the nom­inal voltage is only 3.6 V. In all cases we have to make sure that the maximum dissipation of the
Figure 3. Cascode driver stage with discrete transistor.
package is not exceeded. 24 V is sufficient to energise its are determined by the power
Should this be the case, then the half Watt relay coil, which in PNP (or VMOS) transistor.
number of open collectors turn can drive a load of 16 A at The cascode transistor can be a required will probably justify 230V. ‘digital’ type with integrated resorting to a 7404. For loads driven from the positive base and emitter resistors.A current of around 20 mA at side, the voltage and current lim-


pot as interrupt generator

In battery-powered, microcon­troller driven circuits, as well as with microcontrollers operating in cars, it is desirable to switch the micro into power-down mode once a task has been completed. An interrupt request is then required to wake up the micro. This circuit allows an interrupt to be generated in a simple way using a common potentiometer. In the example circuit, the pot may also copy its spindle position to the ADC. This enables the pot to be used for continuously variable settings (like volume) as well for getting the micro out of its power-down mode.
IC1A is configured as a differen­tiator with R3 preventing oscillation by keeping the gain down to 10 times. Because the opamp oper­ates off a single-rail supply voltage, an 18k/10k potential divider (R1/R2) is able to create a virtual ground level at +1.75 V. This can be done because the LM358 can handle input levels of up to 3.5 V when supplied at 5.0 volts. IC1A supplies a brief High pulse at a falling input voltage, and a similar Low pulse when the input voltage rises. In order to get a High pulse when the potentiome­ter spindle is turned cw or ccw, IC1B is set up as an inverter. Next, each opamp output drives the base of a BC547 transistor. The 5 V-to-0 V transitions at both collector outputs are shaped and combined into a usable interrupt pulse by three NOR gates IC2A, IC2B and IC2C.If the potentiometer spindle is turned very slowly, it is possible that the circuit does not respond
That is why an LED has been added that lights briefly when a pulse is generated. Finally, a tip: a 100-pF capacitor may be connected in parallel with R5 for additional suppres­sion of self-oscillation.

elektor time standart


Elektor Time standard (1988)
Jan Buiting

The Elektor Time Standard and associated Slave Unit were spin-offs of another hugely successful project, the DCF77 Receiver / Locked Frequency Standard. The receiver was published in the January 1988 issue, the Time Standard and Slave display in the next two issues. All units were housed in then very fash­ionable and (expensive!) Ver-obox two-part ABS enclosures which had also been used for a number of Elektor test instrument designs published between 1984 and 1987. The Time Standard box was designed to process seconds pulses received from the VLF (77.5 kHz) DCF77 time standard transmitter in Mainflingen, Ger­many, and display time (with atomic accuracy) and date on an LC display. The circuit was based on then extremely popular 8052AH-BASIC microcontroller from Intel, a device, we can safely claim, that made it to fame & glory thanks to Elektor Electron-
ics. The 40-way DIL chip con­tained a BASIC interpreter capa­ble of executing ‘tokenised’ code from an external EPROM. This, we were told by our resident designer Peter Theunissen, made writing the DCF77 time signal decoding routines ‘a doddle’ using his specially adapted BASIC computer and interpreter. For example, when concerns were raised (by myself) that not all of Europe was in the time zone served by DCF77 (i.e., CET or GMT+1h), a menu option was quickly added to allow users to select between UTC and GMT+1h. As a relative novelty, a ready-made self-adhesive front panel foil with built-in membrane keys was designed into the proj­ect. This expensive item had been produced specially for Elektor. However, when the article went into print (using a rather glum page layout and black & white print), there were yet other con­cerns regarding the range of the DCF77 transmitter. This is offi­cially claimed as “approximately 1,000 km by groundwave propa-

gation”. A quick use of a com­pass and a map of Europe sug­gested that the signal would only cover the south-eastern part of the UK, possibly including Greater London. For a couple of months we waited with baited breath for readers’ responses, only to receive two enthusiastic reception reports, one from the East coast of Ireland and another from Riyadh, Saudi Arabia! The latter report came from a reader work­ing at a chemical laboratory. I remember he wrote that DCF77 could be received for a few min­utes a day only, synchronising the clock, usually around nightfall despite heavy ‘static’. A huge wire antenna was used (nothing like the 1-inch ferrite rods we used in our lab, which is less than 100 km away from Mainflingen). Although the BASIC program list-
ing for the Time Standard was freely distributed to interested readers (on paper, in an enve­lope, by snail mail!), only very advanced readers were able to compile the program into tokenised code and burn it into an EPROM. Most other readers had to rely on a ready-pro­grammed 27C64 supplied through our Readers Services. Apart from displaying time and date at atomic accuracy, the Time Standard was also capable of outputting time/date information

in the form of ASCII character strings for other (intelligent) equip­ment to use, for example, a timer or switching clock. Although sales figures of the PCB and EPROM were in the hundreds, I never heard from anyone actually hav­ing enjoyed the wonders of the ASCII output so extensively described in the article. The Slave unit published in March 1988 was connected to the Time Standard via screened (micro­phone) cable, the idea being that one or more Slave units could be installed on walls in rooms at some distance from the main clock unit. Central timekeeping deluxe for offices, labs, schools and workshops, but at what an expense and design effort! Not too many PCBs were sold for this extension of the Time Standard.