Yes there are many cough medicines that you can safely take whilst you have an ulcer - talk with your pharmacist. You will need to be questioned about the type of cough you have (productive or non-productive) how long you have had it for etc.
You need to look out for any medicines containing nonsteroidal anti-inflammatory drugs (NSAIDs)—such as aspirin and ibuprofen as these can make your ulcer worse.
There are many cough medicines available over the counter that do not contain these ingredients.
Search for questions
Still looking for answers? Try searching for what you seek or ask your own question.