![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Are you sure the polarity of the data was correct?, remember the MAX232 inverts it - and are you sure the baud rate was set correctly?. Both of these will give weird characters.
|
|
|
|
|
|
|
(permalink) |
|
Yes, the baud rate was set correctly as follows in software.
TXBYTE MOVWF BYTE ;save table value to BYTE MOVLW 0x08 MOVWF BITCNT ;do eight times BCF TXPIN ;SEND START BIT CALL Bit_Delay ;delay 104 instruction cycles ;assuming 4MHz clock, that's 1us per instruction cycle ;so delaying 104us TXLOOP RRF BYTE,F ;move BYTE bit0 into carry BTFSS STATUS, C ;a Low ? BCF TXPIN ;yes, send it BTFSC STATUS, C ;a High? BSF TXPIN ;yes, send it CALL Bit_Delay DECFSZ BITCNT GOTO TXLOOP ;loop for 7 more times BSF TXPIN ;SEND STOP BIT CALL Bit_Delay RETURN
__________________
People perish because of lack of knowledge |
|
|
|
|
|
|
(permalink) |
|
sorry about the above post, the 104us delay is generated as follows, I have simulated the program using mplab and the timing is correct.
Bit_Delay MOVLW 0x21 MOVWF DELAYCNT DELAYLOOP DECFSZ DELAYCNT ;one cycle if DELAYCNT GOTO DELAYLOOP ;two cycles RETURN
__________________
People perish because of lack of knowledge |
|
|
|
|
|
|
(permalink) |
|
My code snippets are not coming out clearly, what do I do?
__________________
People perish because of lack of knowledge |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
I did not receive a comment on my delay, is it ok
__________________
People perish because of lack of knowledge |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
__________________
People perish because of lack of knowledge |
||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
ok thanks, feedback later
__________________
People perish because of lack of knowledge |
|
|
|
|