Last active
April 24, 2017 21:59
-
-
Save macchina/7363ccee948821b968d1f59a0253a523 to your computer and use it in GitHub Desktop.
This file contains 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
// J1850 PWM/VPW pin initialization for Macchina M2 | |
// This is just a code snippet showing how to use the J1850 PWM/VPW pins. | |
#include "SamNonDuePin.h" | |
// VPW/PWM pins: | |
const int LPC = PIN_EMAC_ERX0; // LOW POWER CONTROL pin | |
const int PWM_nVPW = PIN_EMAC_EMDC; // PWM/VPW level control, PB8 | |
const int J1850_plus_TX = 45; // PC18 | |
const int J1850_neg_TX = 7; // PC23 | |
const int J1850_VPW_RX = 4; // PC26 | |
const int J1850_PWM_RX = 3; // PC28 | |
void setup() | |
{ | |
pinModeNonDue(LPC, OUTPUT); | |
pinModeNonDue(PWM_nVPW, OUTPUT); | |
digitalWriteNonDue(LPC, HIGH); // LOW = no power at +12V_SW/+5V_SW, HIGH = power at +12V_SW/+5V_SW | |
digitalWriteNonDue(PWM_nVPW, HIGH); // VPW/PWM Select: LOW = 7.87v (VPW), HIGH = 5.88V (PWM) | |
pinMode(J1850_plus_TX, OUTPUT); | |
pinMode(J1850_neg_TX, OUTPUT); | |
pinMode(J1850_VPW_RX, INPUT); | |
pinMode(J1850_PWM_RX, INPUT); | |
} | |
void loop() | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment