This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////////////////////////////////////// | |
// HC12 Program: Demo 3 - Serial Interrupts | |
// Processor: MC9S12XDP512 | |
// Bus Speed: 20 MHz (Requires Active PLL) | |
// Author: AJ Armstrong | |
// Details: Demonstrates basic SCI operation using the DB-9 connector | |
// using interrupts. | |
// Date: Oct 2023 | |
// Revision History : | |
///////////////////////////////////////////////////////////////////////////// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <hidef.h> /* common defines and macros */ | |
#include "derivative.h" /* derivative-specific definitions */ | |
#include "pll.h" | |
#include "swled.h" | |
#include "segs.h" | |
#include "timer.h" | |
//Global Scope Variables | |
volatile counter = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************* | |
rti.h | |
**********************************************/ | |
#ifndef RTIH | |
#define RTIH | |
#include <hidef.h> /* common defines and macros */ | |
#include "derivative.h" | |
extern volatile unsigned int rtiCount; // global counter incremented each time | |
//Note: extern just means that this variable exists but is defined elsewhere |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <hidef.h> /* common defines and macros */ | |
#include "derivative.h" /* derivative-specific definitions */ | |
void main() | |
{ | |
unsigned int iRed = 0; // Variable I will use for | |
// one-time inits | |
PT1AD1 &= 0x1F; | |
DDR1AD1 = 0xE0; | |
ATD1DIEN1 |= 0x1F; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////////////////////////////////////// | |
// Basic Hitachi LCD Demo | |
///////////////////////////////////////////////////////////////////////////// | |
#include <hidef.h> /* common defines and macros */ | |
#include "derivative.h" /* derivative-specific definitions */ | |
#include "pll.h" | |
#include "swled.h" | |
#include "timer.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Return the current state of all 5 switches | |
byte SWL_GetSwitches(void) { | |
// return switch state, masked. | |
return PT1AD1 & 0x1F; //0b0001 1111 | |
} | |
//Return the current state of all 5 switches | |
//but a 1 requires that switch was high both at | |
//the call and after argument miLliseconds. | |
//Uses timer, assumes it is set up. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////////////////////////////////////// | |
// 9S12X Program: YourProg - MiniExplanation | |
// Processor: MC9S12XDP512 | |
// Bus Speed: 20 MHz (Requires Active PLL) | |
// Author: Simon Walker | |
// Details: A more detailed explanation of the program is entered here | |
// Date: Date Created | |
// Revision History : | |
// each revision will have a date + desc. of changes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///////////////////////////////////////////////////////////////////////////// | |
// 9S12X Program: YourProg - MiniExplanation | |
// Processor: MC9S12XDP512 | |
// Bus Speed: 20 MHz (Requires Active PLL) | |
// Author: Simon Walker | |
// Details: A more detailed explanation of the program is entered here | |
// Date: Date Created | |
// Revision History : | |
// each revision will have a date + desc. of changes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Reverse: | |
"""Creates an iterator that reverses the object constructed""" | |
def __init__(self, data): | |
"""Usual constructor. Note that in this case, we need to have | |
a member variable that will maintain my state when implementing | |
__next__for iteration.""" | |
self.data = data # Some iterable set of data | |
self.index = len(data) # data better support the len operation |