Other Parts Discussed in Thread: TLV700
So basically, I have two msp430fr2433 boards, both with HC05, set as master and slave. When connected to the PC and debugging. The slave msp430 gets the data and switches the relays fine. But when I put it on an external power supply, it won't do anything even though the HC05 are connected to each other.
CODE:
#include "msp430.h" ; #define controlled include file
NAME main ; module name
PUBLIC main ; make the main label vissible
; outside this module
ORG 0FFFEh
DC16 init ; set reset vector to 'init' label
RSEG CSTACK ; pre-declaration of segment
RSEG CODE ; place program in 'CODE' segment
RSEG DATA16_N
RXData DW 10h
PreData DW 10h
init: MOV #SFE(CSTACK), SP ; set up stack
main: NOP ; main program
MOV.W #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer
bic.w #LOCKLPM5,PM5CTL0
;18:E4:35F093 <-- Bluetooth Address
;Ports
bis.b #BIT0, P1DIR
bic.b #BIT0, P1OUT
;Relay Ports Open
bis.b #BIT0, P2DIR
bis.b #BIT1, P2DIR
bis.b #BIT5, P2DIR
bis.b #BIT6, P2DIR
;Initalize Ports
bis.b #BIT0, P2OUT
bis.b #BIT1, P2OUT
bis.b #BIT5, P2OUT
bis.b #BIT6, P2OUT
;Testing Motors
;Forward
bic.b #BIT0, P2OUT
bis.b #BIT1, P2OUT
bic.b #BIT5, P2OUT
bis.b #BIT6, P2OUT
;Backward
bis.b #BIT0, P2OUT
bic.b #BIT1, P2OUT
bis.b #BIT5, P2OUT
bic.b #BIT6, P2OUT
;Test Output
;STOP
bis.b #BIT0, P2OUT
bis.b #BIT1, P2OUT
bis.b #BIT5, P2OUT
bis.b #BIT6, P2OUT
bis.w #SCG0, SR
bis.w #SELREF__REFOCLK, &CSCTL3 ;Creates reference for Clock Source = REFOCLK
mov.w #0, &CSCTL0
bic.w #DCORSEL_7, &CSCTL1 ; Clear data @ CSCTL1
bis.w #DCORSEL_3, &CSCTL1 ;Set DCO for 1 MHZ Operation
mov.w #FLLD_0+243, &CSCTL2 ;FLLD+30 = FLLD for 8mhz DCO
nop
nop
nop
bic.w #SCG0, SR
unlockFLL:
mov.w &CSCTL7, R13
and.w #FLLUNLOCK0|FLLUNLOCK1, R13
jnz unlockFLL
mov.w #SELMS__DCOCLKDIV+SELA__REFOCLK, &CSCTL4
bis.b #BIT4+BIT5, &P1SEL0
bis.w #UCSWRST, &UCA0CTLW0
bis.w #UCSSEL__SMCLK,&UCA0CTLW0
mov.b #65, &UCA0BR0
mov.b #3, &UCA0BR1
bis.w #UCBRS2, &UCA0MCTLW
bic.w #UCSWRST, &UCA0CTLW0
clr.w RXData
MainLoop:
bis.w #UCRXIE, &UCA0IE
cmp.w RXData, PreData
jeq Skip
cmp.w #0x02, RXData
jeq Forward
cmp.w #0x01, RXData
jeq Backward
cmp.w #0x00, RXData
jeq Stop
jmp Skip
Forward:
bic.b #BIT0, P2OUT
bis.b #BIT1, P2OUT
bic.b #BIT5, P2OUT
bis.b #BIT6, P2OUT
mov.w RXData, PreData
jmp MainLoop
Backward:
bis.b #BIT0, P2OUT
bic.b #BIT1, P2OUT
bis.b #BIT5, P2OUT
bic.b #BIT6, P2OUT
mov.w RXData, PreData
jmp MainLoop
Stop:
bic.b #BIT0, P2OUT
bic.b #BIT1, P2OUT
bic.b #BIT5, P2OUT
bic.b #BIT6, P2OUT
mov.w RXData, PreData
jmp MainLoop
Skip:
bis.w RXData, PreData
jmp MainLoop
USC_ISR:
mov.w &UCA0RXBUF, RXData
bic.w #UCRXIFG, &UCA0IFG
bic.w #UCRXIE, &UCA0IE
reti
COMMON INTVEC
org USCI_A0_VECTOR
dw USC_ISR
END
This is how the MSP430 receiver is setup. Works fine if it's connected to a computer, but stops completely when its on an external power supply. Any suggestions would be greatly appreciated!
