Em 5/11/2011 15:02, jana1972@centrum.cz escreveu: > I learn programming in assembly language. > > Can anyone let me know if the following program will open RA2 port as out= put and there will=20 > be voltage on that port RA2? > Thanks > > #include "P16F628A.INC" ; Include header file=20 > __CONFIG _INTOSC_OSC_NOCLKOUT > > org 0 > bsf STATUS,RP0 ;bank1 > BCF TRISA,2 > bcf STATUS,RP0 ;bank0 > BSF PORTA,2 > END > > I expect _INTOSC_OSC_NOCLKOUT will cause PIC16F628A to use internal oscil= ator, so=20 > that no external crystal is not needed > Thanks > L. Almost. The register CMCON must be set to 0x07 to disable both analog comparators. The comparators share some pins with PORTA and the PIC comes out of reset with those pins in analog mode. Otherwise your code seems fine, except by the fact that after executing it will continue running astray until the end of the memory and will start over and over. Add a "goto $" or "Loop: goto Loop" as the last instruction. I would reverse the operations, setting "PORTA,2" before clearing "TRISA,2", to avoid a glitch in the pin. Also, don't use absolute mode, use relocatable mode instead. Best regards, Isaac --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .