| ??? 12/09/07 05:32 Read: times |
#148002 - hows this? :) Responding to: ???'s previous message |
I've taken the time to rewrite it bit by bit. I've commented the code as much I think is neccessary and it all seems to work quite well in terms of inputting a value to alter the on/off time. BUT the problem I am now having is I think when I send the values via serial on realterm or the terminal on flashmagic, it is (possibly) interpretting everything as ascii because it just wont work. Code is pasted below :) What programs do people use to communicate over serial?? (with xp) . Cheers! :D
$mod652 org 0h ljmp init org 23h MOV A,S0BUF MOV TON,A ;load a with the value of s0 buffer CLR RI reti org 100h ;------------------ init: SETB ES0 ; enable serial interrupt MOV S0CON,#50H ; SET TO SERIAL MODE1 MOV TMOD,#20H ; SET TIMER 1 TO MODE 2 (8 BIT AUTO RELAOD) MOV TH1,#253 ;SET BAUD TO 9600 SETB TR1 SETB EA ton equ r1 ;on time toff equ r2 ; off time mov ton, #080h ; manually set on time to 080h (50%) jmp loop ;------------------ ;------------------ loop: call makeon setb p3.7 call delayon clr p3.7 ;call makeon call delayoff jmp loop ;------------------ ;------------------ makeon: mov a,#0FFh subb a,ton ;subtract ton from a (255) therefore giving us the value of toff mov toff,a ;load up toff with the result of the subb ret ;------------------ ;------------------ delayon: ;this function loads acc with the value of ton then decrements till its zero and returns mov a,ton delayona: dec a jnz delayona ret ;------------------ ;------------------ delayoff: ;this function loads acc with the value of ton then decrements till its zero and returns mov a,toff delayoffa: dec a jnz delayoffa ret ;------------------ end |
| Topic | Author | Date |
| PWM code thoughts and help? | 01/01/70 00:00 | |
| Some thoughts and help | 01/01/70 00:00 | |
| very good help Russ | 01/01/70 00:00 | |
| cheers! | 01/01/70 00:00 | |
| character for 32 | 01/01/70 00:00 | |
| Good | 01/01/70 00:00 | |
| A & R4 fatal occurence | 01/01/70 00:00 | |
| Info on interrupts | 01/01/70 00:00 | |
| Right next to me... | 01/01/70 00:00 | |
| Aha | 01/01/70 00:00 | |
| tell the truth! | 01/01/70 00:00 | |
| Take a few deep breaths | 01/01/70 00:00 | |
| no arteries popping | 01/01/70 00:00 | |
| hows this? :) | 01/01/70 00:00 | |
| Better, but still has problems | 01/01/70 00:00 | |
| running out of subject line ideas | 01/01/70 00:00 | |
| re: running out of subject line ideas :) | 01/01/70 00:00 | |
| Some comments | 01/01/70 00:00 | |
| Interrupts and shared resources | 01/01/70 00:00 | |
| a thought - if it is help is up to you | 01/01/70 00:00 | |
| More on the PWM program | 01/01/70 00:00 | |
Purpose of my question | 01/01/70 00:00 |



