Вы находитесь на странице: 1из 2

/*

* LEDRegisterWrite.c
*
* This module is used to interface the LED shift register on PortB
*
* Author: Paul Westhoff ME218A FAll 2017
*/

// the common headers for C99 types


#include <stdint.h>
#include <stdbool.h>

// the headers to access the GPIO subsystem


#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
#include "inc/hw_sysctl.h"

// the headers to access the TivaWare Library


#include "driverlib/sysctl.h"
#include "driverlib/pin_map.h"
#include "driverlib/gpio.h"
#include "driverlib/timer.h"
#include "driverlib/interrupt.h"

#include "termio.h"

#include "BITDEFS.H"
#include "ES_Port.h"

// readability defines
#define DATA BIT0HI //GPIO_PIN_0
#define DATA_HI BIT0HI
#define DATA_LO BIT0LO

#define SCLK BIT1HI //GPIO_PIN_1


#define SCLK_HI BIT1HI
#define SCLK_LO BIT1LO

#define RCLK BIT2HI //GPIO_PIN_2


#define RCLK_LO BIT2LO
#define RCLK_HI BIT2HI

#define GET_MSB_IN_LSB(x) ((x & 0x8000) >> 15)

// an image of the last 16 bits written to the shift register


static uint16_t LocalRegisterImage = 0;

// Get the current register being output


uint16_t LED_GetCurrentRegister(void)
{
return LocalRegisterImage;
}

// Outputs16 new bits


void LED_Write(uint16_t NewValue)
{
LocalRegisterImage = NewValue; // save a local copy

// Lower the register clock


HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) &= RCLK_LO;

static uint8_t bitCount;


static uint8_t mostSigBit = 15;
static uint16_t output;

// Shift out the data while pulsing the shift clock


for (bitCount = 0; (bitCount <= mostSigBit); bitCount++)
{
// Test MSB of NewValue and output to Pin0
output = GET_MSB_IN_LSB(NewValue);

if (output)
{
HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) |= DATA_HI;
}
else
{
HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) &= DATA_LO;
}

// Pulse shift clock


HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) |= SCLK_HI;
HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) &= SCLK_LO;

// Shift NewValue left 1 bit


NewValue = NewValue << 1;
}

// Raise the register clock to latch the new data


HWREG(GPIO_PORTB_BASE + (GPIO_O_DATA + ALL_BITS)) |= RCLK_HI;
}

Вам также может понравиться

  • Lee Chao - Cloud Database Development and Management (2013, Auerbach Publications, CRC Press) PDF
    Lee Chao - Cloud Database Development and Management (2013, Auerbach Publications, CRC Press) PDF
    Документ479 страниц
    Lee Chao - Cloud Database Development and Management (2013, Auerbach Publications, CRC Press) PDF
    sequins pillow
    100% (1)
  • SoC - Lab Report
    SoC - Lab Report
    Документ19 страниц
    SoC - Lab Report
    Juan VALVERDE
    Оценок пока нет
  • Convert Optical Mouse Into Arduino Web Camera
    Convert Optical Mouse Into Arduino Web Camera
    Документ8 страниц
    Convert Optical Mouse Into Arduino Web Camera
    Jorge Pablo Ordemar Cisneros
    100% (2)
  • Audioregisterwrite
    Audioregisterwrite
    Документ2 страницы
    Audioregisterwrite
    api-385142684
    Оценок пока нет
  • Shiftregisterwrite C
    Shiftregisterwrite C
    Документ6 страниц
    Shiftregisterwrite C
    api-384633264
    Оценок пока нет
  • Pwmservice
    Pwmservice
    Документ8 страниц
    Pwmservice
    api-438120791
    Оценок пока нет
  • TIVA
    TIVA
    Документ4 страницы
    TIVA
    Gregory Laws
    Оценок пока нет
  • Initgpio: Void Void
    Initgpio: Void Void
    Документ12 страниц
    Initgpio: Void Void
    api-397509789
    Оценок пока нет
  • Vibratingmotor
    Vibratingmotor
    Документ2 страницы
    Vibratingmotor
    api-384495602
    Оценок пока нет
  • Shiftregister C
    Shiftregister C
    Документ2 страницы
    Shiftregister C
    api-340729449
    Оценок пока нет
  • ESP32 DHT LED To THINGSBOARD
    ESP32 DHT LED To THINGSBOARD
    Документ5 страниц
    ESP32 DHT LED To THINGSBOARD
    Fufun Dany
    Оценок пока нет
  • Expt 2
    Expt 2
    Документ8 страниц
    Expt 2
    Shivam Andure
    Оценок пока нет
  • Led C
    Led C
    Документ1 страница
    Led C
    api-272643960
    Оценок пока нет
  • Firmata WIFI
    Firmata WIFI
    Документ37 страниц
    Firmata WIFI
    soo chi
    Оценок пока нет
  • Build An ESP8266 Web Serve1
    Build An ESP8266 Web Serve1
    Документ14 страниц
    Build An ESP8266 Web Serve1
    UYeMin Htike
    Оценок пока нет
  • Build An ESP8266 Web Server
    Build An ESP8266 Web Server
    Документ21 страница
    Build An ESP8266 Web Server
    pinguino2820
    100% (1)
  • Evse Charger
    Evse Charger
    Документ17 страниц
    Evse Charger
    dkvnsyvkgb
    Оценок пока нет
  • Iot Record111
    Iot Record111
    Документ53 страницы
    Iot Record111
    Mohammed Shahid
    Оценок пока нет
  • TP3 - FFT en C Con MXUXpresso
    TP3 - FFT en C Con MXUXpresso
    Документ5 страниц
    TP3 - FFT en C Con MXUXpresso
    Federico Carrillo
    Оценок пока нет
  • Drone Hacker 123
    Drone Hacker 123
    Документ13 страниц
    Drone Hacker 123
    Anonymous 3yqNzCxtTz
    Оценок пока нет
  • U20EC086 ES Lab-8
    U20EC086 ES Lab-8
    Документ5 страниц
    U20EC086 ES Lab-8
    John wick
    Оценок пока нет
  • Standard Firmata Ethernet
    Standard Firmata Ethernet
    Документ34 страницы
    Standard Firmata Ethernet
    soo chi
    Оценок пока нет
  • Lampiran B Program (B1-B7)
    Lampiran B Program (B1-B7)
    Документ7 страниц
    Lampiran B Program (B1-B7)
    rizaldy fachrul
    Оценок пока нет
  • Embedded Design
    Embedded Design
    Документ62 страницы
    Embedded Design
    Mani vannan
    Оценок пока нет
  • Correction TD4
    Correction TD4
    Документ4 страницы
    Correction TD4
    Code Codeur
    Оценок пока нет
  • Test Ads7841.c
    Test Ads7841.c
    Документ2 страницы
    Test Ads7841.c
    Sandeep Kashyap
    Оценок пока нет
  • Arduino Oled Display Nano sr04
    Arduino Oled Display Nano sr04
    Документ2 страницы
    Arduino Oled Display Nano sr04
    lucca1x
    0% (1)
  • Programacion Nodemcu
    Programacion Nodemcu
    Документ12 страниц
    Programacion Nodemcu
    JoséPérezCampos
    Оценок пока нет
  • Arduino Cloud
    Arduino Cloud
    Документ4 страницы
    Arduino Cloud
    Geraldin Montañez Huamán
    Оценок пока нет
  • Esp32 Et MQTT
    Esp32 Et MQTT
    Документ7 страниц
    Esp32 Et MQTT
    Llouis Physics
    Оценок пока нет
  • WATERING Fertilizing
    WATERING Fertilizing
    Документ7 страниц
    WATERING Fertilizing
    Marvin Lucero Fiscal
    Оценок пока нет
  • LCD Interfacing Code
    LCD Interfacing Code
    Документ5 страниц
    LCD Interfacing Code
    datapot465
    Оценок пока нет
  • Final Program
    Final Program
    Документ10 страниц
    Final Program
    karthiha megavarnam
    Оценок пока нет
  • IoT Lab Manual
    IoT Lab Manual
    Документ47 страниц
    IoT Lab Manual
    d20z101
    Оценок пока нет
  • ADC-DHT11 C
    ADC-DHT11 C
    Документ7 страниц
    ADC-DHT11 C
    Giancarlo
    Оценок пока нет
  • BeagleBone and Software Development Using C++ PDF
    BeagleBone and Software Development Using C++ PDF
    Документ2 страницы
    BeagleBone and Software Development Using C++ PDF
    Edgar Guarecuco
    Оценок пока нет
  • Blink Example Main
    Blink Example Main
    Документ2 страницы
    Blink Example Main
    gdesousamarques
    Оценок пока нет
  • Unix Programming Lab
    Unix Programming Lab
    Документ52 страницы
    Unix Programming Lab
    Nithish
    Оценок пока нет
  • MQTT RGB Light For Home
    MQTT RGB Light For Home
    Документ3 страницы
    MQTT RGB Light For Home
    arevazhagunvc
    Оценок пока нет
  • Main CPP
    Main CPP
    Документ52 страницы
    Main CPP
    Narasimha Reddy
    Оценок пока нет
  • Spihsm
    Spihsm
    Документ26 страниц
    Spihsm
    api-438120791
    Оценок пока нет
  • WiFi Robot Remo-WPS Office
    WiFi Robot Remo-WPS Office
    Документ11 страниц
    WiFi Robot Remo-WPS Office
    John Bryan Languido
    Оценок пока нет
  • Esp32 Sin Ultrasonido
    Esp32 Sin Ultrasonido
    Документ2 страницы
    Esp32 Sin Ultrasonido
    Geraldin Montañez Huamán
    Оценок пока нет
  • Code Ok
    Code Ok
    Документ6 страниц
    Code Ok
    Tấn Phát Vũ Bùi
    Оценок пока нет
  • Program Initial For CCS Command
    Program Initial For CCS Command
    Документ15 страниц
    Program Initial For CCS Command
    Thuhtay Ag
    Оценок пока нет
  • Codemau
    Codemau
    Документ8 страниц
    Codemau
    Tiến Bùi Đình
    Оценок пока нет
  • Program-5: Jai Kumar Soni
    Program-5: Jai Kumar Soni
    Документ36 страниц
    Program-5: Jai Kumar Soni
    Pushpen Agrawal
    Оценок пока нет
  • Arduino Code Using DHT Sensor Plus Ethernet
    Arduino Code Using DHT Sensor Plus Ethernet
    Документ2 страницы
    Arduino Code Using DHT Sensor Plus Ethernet
    Boboy Cortezo
    Оценок пока нет
  • SodaPDF-converted-Si5351 RXTX VFO V3
    SodaPDF-converted-Si5351 RXTX VFO V3
    Документ12 страниц
    SodaPDF-converted-Si5351 RXTX VFO V3
    LU8DIW Roberto Martinez
    Оценок пока нет
  • README
    README
    Документ3 страницы
    README
    HeberJehuAbuurtooRaamiirez
    Оценок пока нет
  • Pin F3E8HI6IRHUQRQG.h
    Pin F3E8HI6IRHUQRQG.h
    Документ2 страницы
    Pin F3E8HI6IRHUQRQG.h
    namnguyenht2000
    Оценок пока нет
  • Ardu5 para S4A
    Ardu5 para S4A
    Документ6 страниц
    Ardu5 para S4A
    EDWARD ENRIQUE ROJAS BARBOSA
    Оценок пока нет
  • IOT Lab Experiments
    IOT Lab Experiments
    Документ30 страниц
    IOT Lab Experiments
    poovarasanthstd
    Оценок пока нет
  • LCD4Bit Mod
    LCD4Bit Mod
    Документ5 страниц
    LCD4Bit Mod
    Cleison Armando Manrique Aguirre
    100% (1)
  • Blinky Systick
    Blinky Systick
    Документ2 страницы
    Blinky Systick
    rohanscar_421321698
    Оценок пока нет
  • Webiopi
    Webiopi
    Документ35 страниц
    Webiopi
    encor
    Оценок пока нет
  • Serverclient
    Serverclient
    Документ3 страницы
    Serverclient
    samar shaikh
    Оценок пока нет
  • Block-Code Definition
    Block-Code Definition
    Документ7 страниц
    Block-Code Definition
    Ram Dani
    Оценок пока нет
  • Proiecte Arduino
    Proiecte Arduino
    Документ46 страниц
    Proiecte Arduino
    Syad Aly
    Оценок пока нет
  • Code
    Code
    Документ9 страниц
    Code
    MuHammad TaHir HasSan
    Оценок пока нет
  • CISCO PACKET TRACER LABS: Best practice of configuring or troubleshooting Network
    CISCO PACKET TRACER LABS: Best practice of configuring or troubleshooting Network
    От Everand
    CISCO PACKET TRACER LABS: Best practice of configuring or troubleshooting Network
    Оценок пока нет
  • Attack
    Attack
    Документ4 страницы
    Attack
    api-385142684
    Оценок пока нет
  • Idle
    Idle
    Документ2 страницы
    Idle
    api-385142684
    Оценок пока нет
  • Trex
    Trex
    Документ5 страниц
    Trex
    api-385142684
    Оценок пока нет
  • Time
    Time
    Документ5 страниц
    Time
    api-385142684
    Оценок пока нет
  • Car C
    Car C
    Документ5 страниц
    Car C
    api-385142684
    Оценок пока нет
  • Idle
    Idle
    Документ1 страница
    Idle
    api-385142684
    Оценок пока нет
  • Ledregisterwrite
    Ledregisterwrite
    Документ1 страница
    Ledregisterwrite
    api-385142684
    Оценок пока нет
  • "ES - Configure.h" "ES - Types.h": #Ifndef Car - H #Define Car - H
    "ES - Configure.h" "ES - Types.h": #Ifndef Car - H #Define Car - H
    Документ1 страница
    "ES - Configure.h" "ES - Types.h": #Ifndef Car - H #Define Car - H
    api-385142684
    Оценок пока нет
  • Trex
    Trex
    Документ1 страница
    Trex
    api-385142684
    Оценок пока нет
  • Audioregisterwrite
    Audioregisterwrite
    Документ1 страница
    Audioregisterwrite
    api-385142684
    Оценок пока нет
  • Musicsequence
    Musicsequence
    Документ1 страница
    Musicsequence
    api-385142684
    Оценок пока нет
  • Time
    Time
    Документ1 страница
    Time
    api-385142684
    Оценок пока нет
  • Time
    Time
    Документ9 страниц
    Time
    api-385142684
    Оценок пока нет
  • Trex
    Trex
    Документ10 страниц
    Trex
    api-385142684
    Оценок пока нет
  • Idle
    Idle
    Документ3 страницы
    Idle
    api-385142684
    Оценок пока нет
  • "ES - Configure.h" "ES - Framework.h" "Car.h" "PWM16Tiva.h" "Inc/hw - Memmap.h" "Inc/hw - Types.h" "Inc/hw - Gpio.h" "Inc/hw - Sysctl.h"
    "ES - Configure.h" "ES - Framework.h" "Car.h" "PWM16Tiva.h" "Inc/hw - Memmap.h" "Inc/hw - Types.h" "Inc/hw - Gpio.h" "Inc/hw - Sysctl.h"
    Документ10 страниц
    "ES - Configure.h" "ES - Framework.h" "Car.h" "PWM16Tiva.h" "Inc/hw - Memmap.h" "Inc/hw - Types.h" "Inc/hw - Gpio.h" "Inc/hw - Sysctl.h"
    api-385142684
    Оценок пока нет
  • Insert Data in Database Using PHP
    Insert Data in Database Using PHP
    Документ8 страниц
    Insert Data in Database Using PHP
    Blessie Mercado
    Оценок пока нет
  • Sdi Scilabtec2013
    Sdi Scilabtec2013
    Документ33 страницы
    Sdi Scilabtec2013
    233701
    Оценок пока нет
  • Chapter 3 Types of Computer Networks
    Chapter 3 Types of Computer Networks
    Документ13 страниц
    Chapter 3 Types of Computer Networks
    Abir Hasan
    Оценок пока нет
  • 93c22ce88cd3496585745d16f0c294d0
    93c22ce88cd3496585745d16f0c294d0
    Документ6 страниц
    93c22ce88cd3496585745d16f0c294d0
    haider
    Оценок пока нет
  • Ethernet Cable Straight Through vs. Crossover
    Ethernet Cable Straight Through vs. Crossover
    Документ1 страница
    Ethernet Cable Straight Through vs. Crossover
    Shai Marie
    Оценок пока нет
  • Best Pass
    Best Pass
    Документ9 страниц
    Best Pass
    m4jros
    Оценок пока нет
  • RSTS For Beginners: APRIL, 1986
    RSTS For Beginners: APRIL, 1986
    Документ8 страниц
    RSTS For Beginners: APRIL, 1986
    BobHoskins
    Оценок пока нет
  • Ansible PDF
    Ansible PDF
    Документ11 страниц
    Ansible PDF
    bhlkumar
    Оценок пока нет
  • Opencv
    Opencv
    Документ6 страниц
    Opencv
    GayathriRaji
    Оценок пока нет
  • EUAM Local Staff Application Form 2021-1
    EUAM Local Staff Application Form 2021-1
    Документ4 страницы
    EUAM Local Staff Application Form 2021-1
    Крутые Перцы
    Оценок пока нет
  • Industrial Training Report: Submitted By: Puru Govind (02bce070) Btech (Cse)
    Industrial Training Report: Submitted By: Puru Govind (02bce070) Btech (Cse)
    Документ21 страница
    Industrial Training Report: Submitted By: Puru Govind (02bce070) Btech (Cse)
    Er Meghvrat Arya
    Оценок пока нет
  • Operating Instructions Tankvision NXA820 OPC Server: User Manual
    Operating Instructions Tankvision NXA820 OPC Server: User Manual
    Документ28 страниц
    Operating Instructions Tankvision NXA820 OPC Server: User Manual
    Amanullah
    Оценок пока нет
  • The Internet of Things (Iot)
    The Internet of Things (Iot)
    Документ25 страниц
    The Internet of Things (Iot)
    Ankit Thakkar
    Оценок пока нет
  • Antony Kungu - Final Project Assignment
    Antony Kungu - Final Project Assignment
    Документ11 страниц
    Antony Kungu - Final Project Assignment
    api-420816837
    Оценок пока нет
  • SSA c1510 Exercise Guide
    SSA c1510 Exercise Guide
    Документ202 страницы
    SSA c1510 Exercise Guide
    Sanjay Krishnan
    Оценок пока нет
  • Rapport PFE
    Rapport PFE
    Документ80 страниц
    Rapport PFE
    science path
    Оценок пока нет
  • DP 17 3 SG
    DP 17 3 SG
    Документ24 страницы
    DP 17 3 SG
    EDWIN ALEXANDER VARGAS JIMENEZ
    Оценок пока нет
  • Structure of MIS
    Structure of MIS
    Документ19 страниц
    Structure of MIS
    SAAJID MOHAMED
    Оценок пока нет
  • Big Data - Pros & Cons
    Big Data - Pros & Cons
    Документ2 страницы
    Big Data - Pros & Cons
    Soham Mukhopadhyay
    Оценок пока нет
  • PS Appliance Series OS
    PS Appliance Series OS
    Документ4 страницы
    PS Appliance Series OS
    Debojit Goswami
    Оценок пока нет
  • Compatible Processors With Asus PRIME H610M-K D4 - Pangoly
    Compatible Processors With Asus PRIME H610M-K D4 - Pangoly
    Документ9 страниц
    Compatible Processors With Asus PRIME H610M-K D4 - Pangoly
    Jose Alvarado
    Оценок пока нет
  • Sukhwinder Exam Confirmation
    Sukhwinder Exam Confirmation
    Документ2 страницы
    Sukhwinder Exam Confirmation
    OPERATIONAL WINSTAR
    Оценок пока нет
  • N61 3130 000 000 AeroWave X v6
    N61 3130 000 000 AeroWave X v6
    Документ2 страницы
    N61 3130 000 000 AeroWave X v6
    Marcus Drago
    Оценок пока нет
  • PLC and Arduino Based Boiler Automation Project Thesis Report Dissertation
    PLC and Arduino Based Boiler Automation Project Thesis Report Dissertation
    Документ56 страниц
    PLC and Arduino Based Boiler Automation Project Thesis Report Dissertation
    fida13
    Оценок пока нет
  • Radms
    Radms
    Документ8 страниц
    Radms
    Kiran C N
    Оценок пока нет
  • Troubleshooting and Escalating TSM Scheduled Backup Failure Reports
    Troubleshooting and Escalating TSM Scheduled Backup Failure Reports
    Документ14 страниц
    Troubleshooting and Escalating TSM Scheduled Backup Failure Reports
    Fermin Jr S Gallardo
    Оценок пока нет
  • VGA Connector
    VGA Connector
    Документ2 страницы
    VGA Connector
    syuepi
    Оценок пока нет
  • E-Comerce Rural
    E-Comerce Rural
    Документ10 страниц
    E-Comerce Rural
    Gopi Khunt
    Оценок пока нет
  • B. Red Team Intelligence Gathering: Mxtoolbox Supertool (Links To An External
    B. Red Team Intelligence Gathering: Mxtoolbox Supertool (Links To An External
    Документ3 страницы
    B. Red Team Intelligence Gathering: Mxtoolbox Supertool (Links To An External
    SEARCH ESSAYHELP
    Оценок пока нет